Skip to content

Commit

Permalink
Merge pull request #11 from deseretbook/UPGRADE/solidus-2.4
Browse files Browse the repository at this point in the history
Update for Solidus 2.4
  • Loading branch information
skukx authored Jan 8, 2018
2 parents e814f3c + ff8964a commit d0c5039
Show file tree
Hide file tree
Showing 18 changed files with 34 additions and 34 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Gemfile.lock
.rvmrc
.ruby-version
.ruby-gemset
.byebug_history
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

branch = ENV.fetch('SOLIDUS_BRANCH', 'v2.3')
branch = ENV.fetch('SOLIDUS_BRANCH', 'master')

gem 'solidus', github: 'solidusio/solidus', branch: branch
gem 'solidus_auth_devise', '~> 1.0'
Expand Down
2 changes: 2 additions & 0 deletions app/views/spree/api/wished_products/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json.(@wishlist, *wishlist_attributes)
json.wished_products @wishlist.wished_products, *wished_product_attributes
6 changes: 0 additions & 6 deletions app/views/spree/api/wished_products/show.rabl

This file was deleted.

9 changes: 9 additions & 0 deletions app/views/spree/api/wishlists/index.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
current_page = params[:page].present? ? params[:page].to_i : 1
per_page = params[:per_page].present? ? params[:per_page].to_i : Kaminari.config.default_per_page

json.count @wishlists.count
json.total_count @wishlists.total_count
json.current_page current_page
json.per_page per_page
json.pages @wishlists.total_pages
json.wishlists @wishlists, *wishlist_attributes, :id
9 changes: 0 additions & 9 deletions app/views/spree/api/wishlists/index.rabl

This file was deleted.

2 changes: 2 additions & 0 deletions app/views/spree/api/wishlists/new.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json.attributes wishlist_attributes
json.required_attributes required_fields_for(Spree::Wishlist)
3 changes: 0 additions & 3 deletions app/views/spree/api/wishlists/new.rabl

This file was deleted.

2 changes: 2 additions & 0 deletions app/views/spree/api/wishlists/show.json.jbuilder
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
json.(@wishlist, *wishlist_attributes, :id)
json.wished_products @wishlist.wished_products, *wished_product_attributes
6 changes: 0 additions & 6 deletions app/views/spree/api/wishlists/show.rabl

This file was deleted.

2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
environment:
SOLIDUS_BRANCH: v2.2
SOLIDUS_BRANCH: master
ruby:
version: 2.3.1

Expand Down
4 changes: 2 additions & 2 deletions solidus_wishlist.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Gem::Specification.new do |s|

s.add_runtime_dependency 'solidus_core', [">= 1.0.0", "< 3"]

s.add_development_dependency 'factory_girl'
s.add_development_dependency 'factory_bot'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails'
s.add_development_dependency 'sqlite3'
Expand All @@ -36,5 +36,5 @@ Gem::Specification.new do |s|
s.add_development_dependency 'coffee-rails'
s.add_development_dependency 'sass-rails'
s.add_development_dependency 'guard-rspec'
s.add_development_dependency 'pry-rails'
s.add_development_dependency 'byebug'
end
8 changes: 8 additions & 0 deletions spec/controllers/spree/api/wishlists_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'spec_helper'

RSpec.describe Spree::Api::WishlistsController, type: :request do
let(:wishlist) { create(:wishlist) }
let(:user) { wishlist.user }
Expand All @@ -14,7 +16,9 @@

it 'return a list of available attributes' do
get "/api/wishlists/new?token=#{user.spree_api_key}"

expect(response).to be_success
expect(response).to render_template 'spree/api/wishlists/new'
expect(json['attributes'].length).to eq(5)
expect(json['required_attributes'].length).to eq(1)
end
Expand Down Expand Up @@ -73,6 +77,8 @@
not_admin_user = create(:user)
not_admin_user.generate_spree_api_key!
get "/api/wishlists?user_id=#{santa_claus.id}&token=#{not_admin_user.spree_api_key}&page=2&per_page=10"

expect(response).to render_template('spree/api/wishlists/index')
expect(response).to be_success
expect(json['total_count']).to eq 0
end
Expand All @@ -85,7 +91,9 @@

it 'returns wish list details' do
get "/api/wishlists/#{wishlist.access_hash}?token=#{user.spree_api_key}"

expect(response).to be_success
expect(response).to render_template('spree/api/wishlists/show')
expect(json['access_hash']).to eq wishlist.access_hash
expect(json['id']).to eq wishlist.id
expect(json['name']).to eq wishlist.name
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/user_with_wishlist_factory.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :user_with_wishlist, parent: :user do
after :create do |user|
user << create(:wishlist)
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/wished_product_factory.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :wished_product, class: Spree::WishedProduct do
variant
wishlist
Expand Down
2 changes: 1 addition & 1 deletion spec/factories/wishlist_factory.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FactoryGirl.define do
FactoryBot.define do
factory :wishlist, class: Spree::Wishlist do
user
sequence(:name) {|n| "Wishlist_#{n}" }
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require 'rspec/rails'
require 'ffaker'
require 'shoulda-matchers'
require 'pry'
require 'byebug'

Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each {|file| require file }

Expand Down
4 changes: 2 additions & 2 deletions spec/support/factory_girl.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'factory_girl'

FactoryGirl.find_definitions
FactoryBot.find_definitions

RSpec.configure do |config|
config.include FactoryGirl::Syntax::Methods
config.include FactoryBot::Syntax::Methods
end

0 comments on commit d0c5039

Please sign in to comment.