power_shop 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d232f3693838064da2a8e2015cfb33ca7d106ef2
4
- data.tar.gz: 7aa3f906871251a5242f293eb55af311790e5e8c
3
+ metadata.gz: 01e98c06bba9a959d001bd233a9b2b5a9d0e6cb1
4
+ data.tar.gz: fab2085c166acb99466442b2aef3c991af12ef86
5
5
  SHA512:
6
- metadata.gz: a1417fdf65fd813ebb4a28e97fb1643215c3b6220e94041cbc878dc20a24388200c01e277c398b3f69e87abad47f4fd0eb49c0f3f280d1bd75efd34d6dd02c66
7
- data.tar.gz: c84eb369d903337cad604b196f9b9e0e89f1f1e8cb613faac2e9d63fa77cff39d0cedb382008f49f9ded485f927b5e3b6e3056c1b9c75e2935d37c3d9bcca8fe
6
+ metadata.gz: 4b33793a7db19181b619ca332651bd7bc1e75db466a6df2fe0412670188d65a9990da132a1b41409a3e542aa9ec3c396a9df9cfa6f2a212d41033bf2188d2f7b
7
+ data.tar.gz: c6ca774c924d8e8064f653294c9ff114863874e91df5cbfd62565ff607f022c1444c5ecfd63f250ac64b96bcf2022b90fc6a0fe0624a09d7260aa452d4634f88
@@ -11,7 +11,7 @@ module PowerShop
11
11
  #
12
12
  # Returns text/html or text/json
13
13
  def add_product
14
- cart.add(@product, @product.price, params.fetch(:quantity, 1))
14
+ cart.add(@product, @product.price, params.fetch(:quantity, 1).to_i)
15
15
 
16
16
  if request.xhr?
17
17
  render_json_cart
@@ -1,3 +1,3 @@
1
1
  module PowerShop
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
data/power_shop.gemspec CHANGED
@@ -24,7 +24,6 @@ Gem::Specification.new do |s|
24
24
 
25
25
  s.add_dependency 'carrierwave'
26
26
  s.add_dependency 'kaminari'
27
- # TODO: migrate to minimagic
28
27
  s.add_dependency 'mini_magick'
29
28
  s.add_dependency 'validates_email_format_of'
30
29
 
@@ -5,7 +5,7 @@ describe PowerShop::CartController, :type => :controller do
5
5
  let(:cart) { create :shopping_cart }
6
6
  let(:product) { create :product, price: 500 }
7
7
 
8
- before { controller.stub(:cart).and_return(cart) }
8
+ before { allow(controller).to receive(:cart).and_return(cart) }
9
9
 
10
10
  describe '#POST add_product' do
11
11
  before { request.env["HTTP_REFERER"] = "/" }
@@ -29,8 +29,17 @@ describe PowerShop::CartController, :type => :controller do
29
29
  it { expect(expected_json['subtotal']).to eq 500 }
30
30
  end
31
31
 
32
+ context 'when product already in a cart' do
33
+ before do
34
+ cart.add(product, product.price, 1)
35
+ xhr :post, :add_product, product_id: product.id, quantity: '1', use_route: 'power_shop'
36
+ end
37
+
38
+ it { expect(cart.shopping_cart_items.first.quantity).to eq 2 }
39
+ end
40
+
32
41
  context 'when exists quantity param' do
33
- before { post :add_product, product_id: product.id, quantity: 2, use_route: 'power_shop' }
42
+ before { post :add_product, product_id: product.id, quantity: '2', use_route: 'power_shop' }
34
43
 
35
44
  it { expect(cart.shopping_cart_items.first.quantity).to eq 2 }
36
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: power_shop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Semyon Pupkov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-19 00:00:00.000000000 Z
11
+ date: 2014-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -387,64 +387,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
387
387
  version: '0'
388
388
  requirements: []
389
389
  rubyforge_project:
390
- rubygems_version: 2.0.6
390
+ rubygems_version: 2.0.3
391
391
  signing_key:
392
392
  specification_version: 4
393
393
  summary: Simple and flexible Ruby On Rails Ecomerce engine
394
- test_files:
395
- - spec/controllers/cart_controller_spec.rb
396
- - spec/controllers/catalog_controller_spec.rb
397
- - spec/dummy/README.rdoc
398
- - spec/dummy/Rakefile
399
- - spec/dummy/app/assets/images/.keep
400
- - spec/dummy/app/assets/javascripts/application.js
401
- - spec/dummy/app/assets/stylesheets/application.css
402
- - spec/dummy/app/controllers/application_controller.rb
403
- - spec/dummy/app/controllers/concerns/.keep
404
- - spec/dummy/app/helpers/application_helper.rb
405
- - spec/dummy/app/mailers/.keep
406
- - spec/dummy/app/models/.keep
407
- - spec/dummy/app/models/concerns/.keep
408
- - spec/dummy/app/views/layouts/application.html.erb
409
- - spec/dummy/bin/bundle
410
- - spec/dummy/bin/rails
411
- - spec/dummy/bin/rake
412
- - spec/dummy/config.ru
413
- - spec/dummy/config/application.rb
414
- - spec/dummy/config/boot.rb
415
- - spec/dummy/config/database.yml
416
- - spec/dummy/config/environment.rb
417
- - spec/dummy/config/environments/development.rb
418
- - spec/dummy/config/environments/production.rb
419
- - spec/dummy/config/environments/test.rb
420
- - spec/dummy/config/initializers/assets.rb
421
- - spec/dummy/config/initializers/backtrace_silencers.rb
422
- - spec/dummy/config/initializers/cookies_serializer.rb
423
- - spec/dummy/config/initializers/filter_parameter_logging.rb
424
- - spec/dummy/config/initializers/inflections.rb
425
- - spec/dummy/config/initializers/mime_types.rb
426
- - spec/dummy/config/initializers/secret_token.rb
427
- - spec/dummy/config/initializers/session_store.rb
428
- - spec/dummy/config/initializers/wrap_parameters.rb
429
- - spec/dummy/config/locales/en.yml
430
- - spec/dummy/config/routes.rb
431
- - spec/dummy/config/secrets.yml
432
- - spec/dummy/db/schema.rb
433
- - spec/dummy/lib/assets/.keep
434
- - spec/dummy/log/.keep
435
- - spec/dummy/log/development.log
436
- - spec/dummy/public/404.html
437
- - spec/dummy/public/422.html
438
- - spec/dummy/public/500.html
439
- - spec/dummy/public/favicon.ico
440
- - spec/factories/categories.rb
441
- - spec/factories/order.rb
442
- - spec/factories/products.rb
443
- - spec/factories/shopping_cart.rb
444
- - spec/lib/middleware/shopping_cart_spec.rb
445
- - spec/models/category_spec.rb
446
- - spec/models/order_item_spec.rb
447
- - spec/models/order_spec.rb
448
- - spec/models/product_spec.rb
449
- - spec/models/shop_image_spec.rb
450
- - spec/spec_helper.rb
394
+ test_files: []