acts_as_shopping_cart 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.rubocop.yml +11 -0
- data/.travis.yml +6 -2
- data/CHANGELOG.md +10 -0
- data/Gemfile.4.0 +1 -0
- data/Gemfile.4.1 +1 -0
- data/Gemfile.4.2 +1 -0
- data/Gemfile.5.0 +7 -0
- data/README.markdown +5 -11
- data/Rakefile +4 -4
- data/acts_as_shopping_cart.gemspec +13 -10
- data/features/step_definitions/product_steps.rb +1 -1
- data/features/step_definitions/shopping_cart_steps.rb +10 -11
- data/features/support/env.rb +16 -8
- data/features/support/rails_env.rb +3 -3
- data/lib/active_record/acts/shopping_cart.rb +3 -4
- data/lib/active_record/acts/shopping_cart/collection.rb +26 -14
- data/lib/active_record/acts/shopping_cart/item.rb +1 -1
- data/lib/active_record/acts/shopping_cart_item.rb +4 -4
- data/lib/active_record/acts/shopping_cart_item/instance_methods.rb +5 -5
- data/lib/acts_as_shopping_cart.rb +9 -9
- data/lib/acts_as_shopping_cart/schema.rb +1 -1
- data/lib/acts_as_shopping_cart/version.rb +1 -1
- data/spec/active_record/acts/shopping_cart/collection_spec.rb +72 -50
- data/spec/active_record/acts/shopping_cart/item_spec.rb +25 -25
- data/spec/active_record/acts/shopping_cart_item/instance_methods_spec.rb +8 -8
- data/spec/spec_helper.rb +12 -8
- metadata +56 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4f7ed62db4ed5b247d005dcafc10eb7ebdb3773
|
4
|
+
data.tar.gz: 68c2a98c28d253d7077e1d0b93d1054f9c3c0820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d841c20dcd7cd9344422fb99b95248dd1f92bb02ab0b8335de1b97f4b4d6b43ba6329332f04d7423d0ec7123ffebb5066a9db547a8f332476ec1fecb00748b0
|
7
|
+
data.tar.gz: 63e9b2b8e4e2df46e1efd4db8afe96933336c51d57ee7136e251a184eff66b438080d9618f72624bbdbc869c83fbc3b922bc5c9399715cfcc6df17f03f3b4979
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# CHANGELOG
|
2
|
+
|
3
|
+
## 0.4.0
|
4
|
+
|
5
|
+
- Updated dependencies to use it on Rails 5
|
6
|
+
|
7
|
+
### Breaking changes
|
8
|
+
|
9
|
+
- Remove the `empty?` method and add `has_items?` and `has_no_items?`.
|
10
|
+
- Updated money-rails dependency to at least 1.5 which can potentially break your app.
|
data/Gemfile.4.0
CHANGED
data/Gemfile.4.1
CHANGED
data/Gemfile.4.2
CHANGED
data/Gemfile.5.0
ADDED
data/README.markdown
CHANGED
@@ -2,9 +2,11 @@
|
|
2
2
|
|
3
3
|
A simple shopping cart implementation.
|
4
4
|
|
5
|
-
[![Build Status](https://secure.travis-ci.org/
|
5
|
+
[![Build Status](https://secure.travis-ci.org/dabit/acts_as_shopping_cart.png?branch=master)](http://travis-ci.org/dabit/acts_as_shopping_cart)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/dabit/acts_as_shopping_cart/badges/gpa.svg)](https://codeclimate.com/github/dabit/acts_as_shopping_cart)
|
7
|
+
[![Test Coverage](https://codeclimate.com/github/dabit/acts_as_shopping_cart/badges/coverage.svg)](https://codeclimate.com/github/dabit/acts_as_shopping_cart/coverage)
|
6
8
|
|
7
|
-
You can find an example application [here](https://github.com/
|
9
|
+
You can find an example application [here](https://github.com/dabit/acts_as_shopping_cart_app).
|
8
10
|
|
9
11
|
## Install
|
10
12
|
|
@@ -15,7 +17,7 @@ if you still need to implement this gem in a Rails 3 app**
|
|
15
17
|
|
16
18
|
Include it in your Gemfile
|
17
19
|
|
18
|
-
gem 'acts_as_shopping_cart', :github => '
|
20
|
+
gem 'acts_as_shopping_cart', :github => 'dabit/acts_as_shopping_cart', :branch => '0-1-x'
|
19
21
|
|
20
22
|
And run bundler
|
21
23
|
|
@@ -190,11 +192,3 @@ Run cucumber features
|
|
190
192
|
Both:
|
191
193
|
|
192
194
|
rake
|
193
|
-
|
194
|
-
# About the author
|
195
|
-
|
196
|
-
[Crowd Interactive](http://www.crowdint.com) is a leading Ruby and Rails
|
197
|
-
consultancy firm based in Mexico currently doing business with startups in the
|
198
|
-
United States. We specialize in building and growing Rails applications, by increasing
|
199
|
-
your IT crew onsite or offsite. We pick our projects carefully, as we only work
|
200
|
-
with companies we believe in.
|
data/Rakefile
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
2
|
|
3
|
-
require
|
3
|
+
require "cucumber/rake/task"
|
4
4
|
Cucumber::Rake::Task.new do |t|
|
5
|
-
t.cucumber_opts =
|
5
|
+
t.cucumber_opts = "--format progress"
|
6
6
|
end
|
7
7
|
|
8
|
-
require
|
8
|
+
require "rspec/core/rake_task"
|
9
9
|
RSpec::Core::RakeTask.new do |t|
|
10
10
|
t.fail_on_error = true
|
11
11
|
end
|
12
12
|
|
13
|
-
task :
|
13
|
+
task default: [:spec, :cucumber]
|
@@ -1,15 +1,16 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
3
|
+
|
3
4
|
require "acts_as_shopping_cart/version"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
6
7
|
s.name = "acts_as_shopping_cart"
|
7
8
|
s.version = ActsAsShoppingCart::VERSION
|
8
9
|
s.authors = ["David Padilla"]
|
9
|
-
s.email = ["david@
|
10
|
+
s.email = ["david@padilla.io"]
|
10
11
|
s.homepage = ""
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
12
|
+
s.summary = "Simple Shopping Cart implementation"
|
13
|
+
s.description = "Simple Shopping Cart implementation"
|
13
14
|
|
14
15
|
s.rubyforge_project = "acts_as_shopping_cart"
|
15
16
|
|
@@ -18,13 +19,15 @@ Gem::Specification.new do |s|
|
|
18
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
20
|
s.require_paths = ["lib"]
|
20
21
|
|
21
|
-
s.add_dependency
|
22
|
-
s.add_dependency
|
22
|
+
s.add_dependency "rails", "> 4"
|
23
|
+
s.add_dependency "money-rails", "~> 1.5"
|
23
24
|
|
24
|
-
s.add_development_dependency "cucumber"
|
25
|
+
s.add_development_dependency "cucumber"
|
25
26
|
s.add_development_dependency "database_cleaner"
|
26
|
-
s.add_development_dependency "rake"
|
27
|
-
s.add_development_dependency "rspec"
|
28
|
-
s.add_development_dependency "sqlite3"
|
27
|
+
s.add_development_dependency "rake"
|
28
|
+
s.add_development_dependency "rspec"
|
29
|
+
s.add_development_dependency "sqlite3"
|
29
30
|
s.add_development_dependency "simplecov"
|
31
|
+
s.add_development_dependency "rubocop"
|
32
|
+
s.add_development_dependency "codeclimate-test-reporter"
|
30
33
|
end
|
@@ -4,12 +4,12 @@ end
|
|
4
4
|
|
5
5
|
Then /^the total for the cart should be "([^"]*)"$/ do |total|
|
6
6
|
@cart.reload
|
7
|
-
@cart.total.
|
7
|
+
expect(@cart.total).to eq(Money.new(total.to_f * 100))
|
8
8
|
end
|
9
9
|
|
10
10
|
Then /^the subtotal for the cart should be "([^"]*)"$/ do |subtotal|
|
11
11
|
@cart.reload
|
12
|
-
@cart.subtotal.
|
12
|
+
expect(@cart.subtotal).to eq(Money.new(subtotal.to_f * 100))
|
13
13
|
end
|
14
14
|
|
15
15
|
When /^I add product "([^"]*)" to cart with price "([^"]*)"$/ do |product_name, price|
|
@@ -24,10 +24,10 @@ end
|
|
24
24
|
|
25
25
|
Then /^the total unique items on the cart should be "([^"]*)"$/ do |total|
|
26
26
|
@cart.reload
|
27
|
-
@cart.total_unique_items.
|
27
|
+
expect(@cart.total_unique_items).to eq(total.to_i)
|
28
28
|
end
|
29
29
|
|
30
|
-
When /^I remove (\d+) "([^"]*)" unit(s?) from cart$/ do |quantity, product_name,
|
30
|
+
When /^I remove (\d+) "([^"]*)" unit(s?) from cart$/ do |quantity, product_name, _|
|
31
31
|
@cart.reload
|
32
32
|
product = Product.find_by_name(product_name)
|
33
33
|
@cart.remove(product, quantity.to_i)
|
@@ -39,7 +39,7 @@ end
|
|
39
39
|
|
40
40
|
Then /^cart should be empty$/ do
|
41
41
|
@cart.reload
|
42
|
-
@cart.
|
42
|
+
expect(@cart.has_no_items?).to be true
|
43
43
|
end
|
44
44
|
|
45
45
|
Given /^I add (\d+) "([^"]*)" products to cart with price "([^"]*)"$/ do |quantity, product_name, price|
|
@@ -50,19 +50,19 @@ end
|
|
50
50
|
Then /^the subtotal for "([^"]*)" on the cart should be "([^"]*)"$/ do |product_name, subtotal|
|
51
51
|
@cart.reload
|
52
52
|
product = Product.find_by_name(product_name)
|
53
|
-
@cart.subtotal_for(product).
|
53
|
+
expect(@cart.subtotal_for(product)).to eq(subtotal.to_f)
|
54
54
|
end
|
55
55
|
|
56
56
|
Then /^the quantity for "([^"]*)" on the cart should be "([^"]*)"$/ do |product_name, quantity|
|
57
57
|
@cart.reload
|
58
58
|
product = Product.find_by_name(product_name)
|
59
|
-
@cart.quantity_for(product).
|
59
|
+
expect(@cart.quantity_for(product)).to eq(quantity.to_f)
|
60
60
|
end
|
61
61
|
|
62
62
|
Then /^the price for "([^"]*)" on the cart should be "([^"]*)"$/ do |product_name, price|
|
63
63
|
@cart.reload
|
64
64
|
product = Product.find_by_name(product_name)
|
65
|
-
@cart.price_for(product).
|
65
|
+
expect(@cart.price_for(product)).to eq(Money.from_amount(price.to_f))
|
66
66
|
end
|
67
67
|
|
68
68
|
When /^I update the "([^"]*)" quantity to "([^"]*)"$/ do |product_name, quantity|
|
@@ -77,9 +77,8 @@ When /^I update the "([^"]*)" price to "([^"]*)"$/ do |product_name, price|
|
|
77
77
|
@cart.update_price_for(product, price.to_f)
|
78
78
|
end
|
79
79
|
|
80
|
-
Then /^shopping cart item "([^"]*)" should belong to cart$/ do |
|
80
|
+
Then /^shopping cart item "([^"]*)" should belong to cart$/ do |_|
|
81
81
|
@cart.reload
|
82
82
|
shopping_cart_item = ShoppingCartItem.last
|
83
|
-
shopping_cart_item.owner.
|
83
|
+
expect(shopping_cart_item.owner).to eq @cart
|
84
84
|
end
|
85
|
-
|
data/features/support/env.rb
CHANGED
@@ -1,18 +1,26 @@
|
|
1
|
-
require
|
1
|
+
require "bundler/setup"
|
2
2
|
|
3
|
-
require
|
4
|
-
|
5
|
-
require 'money-rails'
|
3
|
+
require "codeclimate-test-reporter"
|
4
|
+
CodeClimate::TestReporter.start
|
6
5
|
|
7
|
-
|
6
|
+
require "active_record"
|
7
|
+
require "database_cleaner"
|
8
|
+
require "money-rails"
|
9
|
+
require "rspec"
|
8
10
|
|
9
|
-
|
11
|
+
$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
12
|
+
|
13
|
+
require "acts_as_shopping_cart"
|
10
14
|
|
11
15
|
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
12
16
|
|
13
17
|
MoneyRails::Hooks.init
|
14
18
|
|
15
|
-
|
19
|
+
RSpec.configure do |config|
|
20
|
+
config.raise_errors_for_deprecations!
|
21
|
+
end
|
22
|
+
|
23
|
+
require "simplecov"
|
16
24
|
|
17
|
-
SimpleCov.coverage_dir
|
25
|
+
SimpleCov.coverage_dir "coverage.features"
|
18
26
|
SimpleCov.start
|
@@ -1,7 +1,7 @@
|
|
1
|
-
ActiveRecord::Base.establish_connection(:
|
2
|
-
#ActiveRecord::Base.logger = Logger.new(STDOUT)
|
1
|
+
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
|
2
|
+
# ActiveRecord::Base.logger = Logger.new(STDOUT)
|
3
3
|
|
4
|
-
ActiveRecord::Schema.define(:
|
4
|
+
ActiveRecord::Schema.define(version: 1) do
|
5
5
|
create_table :shopping_carts
|
6
6
|
create_table :shopping_cart_items do |t|
|
7
7
|
t.shopping_cart_item_fields
|
@@ -17,10 +17,9 @@ module ActiveRecord
|
|
17
17
|
#
|
18
18
|
#
|
19
19
|
def acts_as_shopping_cart_using(item_class)
|
20
|
-
|
21
|
-
|
22
|
-
has_many :shopping_cart_items, :
|
23
|
-
:as => :owner, :dependent => :destroy
|
20
|
+
send :include, ActiveRecord::Acts::ShoppingCart::Collection
|
21
|
+
send :include, ActiveRecord::Acts::ShoppingCart::Item
|
22
|
+
has_many :shopping_cart_items, class_name: item_class.to_s.classify, as: :owner, dependent: :destroy
|
24
23
|
end
|
25
24
|
|
26
25
|
#
|
@@ -25,24 +25,34 @@ module ActiveRecord
|
|
25
25
|
shopping_cart_items.clear
|
26
26
|
end
|
27
27
|
|
28
|
+
#
|
29
|
+
# Returns true when the cart has items
|
30
|
+
#
|
31
|
+
def has_items?
|
32
|
+
shopping_cart_items.any?
|
33
|
+
end
|
34
|
+
|
28
35
|
#
|
29
36
|
# Returns true when the cart is empty
|
30
37
|
#
|
31
|
-
def
|
38
|
+
def has_no_items?
|
32
39
|
shopping_cart_items.empty?
|
33
40
|
end
|
34
41
|
|
42
|
+
|
35
43
|
#
|
36
44
|
# Remove an item from the cart
|
37
45
|
#
|
38
46
|
def remove(object, quantity = 1)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
47
|
+
cart_item = item_for(object)
|
48
|
+
|
49
|
+
return unless cart_item
|
50
|
+
|
51
|
+
if cart_item.quantity <= quantity
|
52
|
+
cart_item.delete
|
53
|
+
else
|
54
|
+
cart_item.quantity = (cart_item.quantity - quantity)
|
55
|
+
cart_item.save
|
46
56
|
end
|
47
57
|
end
|
48
58
|
|
@@ -51,7 +61,7 @@ module ActiveRecord
|
|
51
61
|
# items in the cart
|
52
62
|
#
|
53
63
|
def subtotal
|
54
|
-
shopping_cart_items.inject(Money.new(0)) { |
|
64
|
+
shopping_cart_items.inject(Money.new(0)) { |a, e| a + (e.price * e.quantity) }
|
55
65
|
end
|
56
66
|
|
57
67
|
def shipping_cost
|
@@ -59,7 +69,7 @@ module ActiveRecord
|
|
59
69
|
end
|
60
70
|
|
61
71
|
def taxes
|
62
|
-
subtotal *
|
72
|
+
subtotal * tax_pct * 0.01
|
63
73
|
end
|
64
74
|
|
65
75
|
def tax_pct
|
@@ -70,19 +80,21 @@ module ActiveRecord
|
|
70
80
|
# Returns the total by summing the subtotal, taxes and shipping_cost
|
71
81
|
#
|
72
82
|
def total
|
73
|
-
|
83
|
+
subtotal + taxes + shipping_cost
|
74
84
|
end
|
75
85
|
|
76
86
|
#
|
77
87
|
# Return the number of unique items in the cart
|
78
88
|
#
|
79
89
|
def total_unique_items
|
80
|
-
shopping_cart_items.
|
90
|
+
shopping_cart_items.map(&:quantity).sum
|
81
91
|
end
|
82
92
|
|
83
93
|
def cart_items
|
84
|
-
warn "ShoppingCart#cart_items WILL BE DEPRECATED IN LATER VERSIONS OF acts_as_shopping_cart,
|
85
|
-
|
94
|
+
warn "ShoppingCart#cart_items WILL BE DEPRECATED IN LATER VERSIONS OF acts_as_shopping_cart," \
|
95
|
+
" please use ShoppingCart#shopping_cart_items instead"
|
96
|
+
|
97
|
+
shopping_cart_items
|
86
98
|
end
|
87
99
|
end
|
88
100
|
end
|
@@ -16,10 +16,10 @@ module ActiveRecord
|
|
16
16
|
# acts_as_shopping_cart_item :cart
|
17
17
|
#
|
18
18
|
#
|
19
|
-
def acts_as_shopping_cart_item_for(
|
20
|
-
|
21
|
-
belongs_to :owner, :
|
22
|
-
belongs_to :item, :
|
19
|
+
def acts_as_shopping_cart_item_for(*)
|
20
|
+
send :include, ActiveRecord::Acts::ShoppingCartItem::InstanceMethods
|
21
|
+
belongs_to :owner, polymorphic: true
|
22
|
+
belongs_to :item, polymorphic: true
|
23
23
|
monetize :price_cents
|
24
24
|
end
|
25
25
|
|
@@ -6,23 +6,23 @@ module ActiveRecord
|
|
6
6
|
# Returns the subtotal, multiplying the quantity times the price of the item.
|
7
7
|
#
|
8
8
|
def subtotal
|
9
|
-
("%.2f"
|
9
|
+
format("%.2f", quantity * price).to_f
|
10
10
|
end
|
11
11
|
|
12
12
|
#
|
13
13
|
# Updates the quantity of the item
|
14
14
|
#
|
15
15
|
def update_quantity(new_quantity)
|
16
|
-
|
17
|
-
|
16
|
+
self.quantity = new_quantity
|
17
|
+
save
|
18
18
|
end
|
19
19
|
|
20
20
|
#
|
21
21
|
# Updates the price of the item
|
22
22
|
#
|
23
23
|
def update_price(new_price)
|
24
|
-
|
25
|
-
|
24
|
+
self.price = new_price
|
25
|
+
save
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -1,19 +1,19 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
require "acts_as_shopping_cart/version"
|
2
|
+
require "rails"
|
3
|
+
require "money-rails"
|
4
|
+
require "active_record/acts/shopping_cart"
|
5
|
+
require "active_record/acts/shopping_cart_item"
|
6
|
+
require "acts_as_shopping_cart/schema"
|
7
7
|
|
8
8
|
module ActiveRecord
|
9
9
|
module Acts
|
10
10
|
module ShoppingCart
|
11
|
-
autoload :Collection ,
|
12
|
-
autoload :Item ,
|
11
|
+
autoload :Collection , "active_record/acts/shopping_cart/collection"
|
12
|
+
autoload :Item , "active_record/acts/shopping_cart/item"
|
13
13
|
end
|
14
14
|
|
15
15
|
module ShoppingCartItem
|
16
|
-
autoload :InstanceMethods,
|
16
|
+
autoload :InstanceMethods, "active_record/acts/shopping_cart_item/instance_methods"
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
2
|
-
# require
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "../../../../spec_helper")
|
2
|
+
# require "spec_helper"
|
3
3
|
|
4
4
|
describe ActiveRecord::Acts::ShoppingCart::Collection do
|
5
5
|
let(:klass) do
|
@@ -9,62 +9,62 @@ describe ActiveRecord::Acts::ShoppingCart::Collection do
|
|
9
9
|
|
10
10
|
let(:subject) do
|
11
11
|
subject = klass.new
|
12
|
-
subject.
|
12
|
+
allow(subject).to receive(:shopping_cart_items).and_return([])
|
13
13
|
subject
|
14
14
|
end
|
15
15
|
|
16
|
-
let(:object) {
|
16
|
+
let(:object) { double }
|
17
17
|
|
18
18
|
let(:shopping_cart_item) do
|
19
|
-
|
19
|
+
instance_double("shopping_cart_item", quantity: 2, save: true)
|
20
20
|
end
|
21
21
|
|
22
22
|
describe :add do
|
23
23
|
context "item is not on cart" do
|
24
24
|
before do
|
25
|
-
subject.
|
25
|
+
allow(subject).to receive(:item_for).with(object)
|
26
26
|
end
|
27
27
|
|
28
28
|
it "creates a new shopping cart item" do
|
29
|
-
created_object =
|
30
|
-
subject.shopping_cart_items.
|
31
|
-
|
32
|
-
|
29
|
+
created_object = double
|
30
|
+
expect(subject.shopping_cart_items).to receive(:create)
|
31
|
+
.with(item: object, price: 19.99, quantity: 3)
|
32
|
+
.and_return(created_object)
|
33
33
|
item = subject.add(object, 19.99, 3)
|
34
|
-
item.
|
34
|
+
expect(item).to be created_object
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
context "item is not in cart" do
|
39
39
|
before do
|
40
|
-
subject.
|
40
|
+
allow(subject).to receive(:item_for).with(object)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "creates a new shopping cart item non-cumulatively" do
|
44
|
-
subject.shopping_cart_items.
|
44
|
+
expect(subject.shopping_cart_items).to receive(:create).with(item: object, price: 19.99, quantity: 3)
|
45
45
|
subject.add(object, 19.99, 3, false)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
context "item is already on cart" do
|
50
50
|
before do
|
51
|
-
subject.
|
51
|
+
allow(subject).to receive(:item_for).with(object).and_return(shopping_cart_item)
|
52
52
|
end
|
53
53
|
|
54
54
|
it "updates the quantity for the item" do
|
55
|
-
shopping_cart_item.
|
55
|
+
expect(shopping_cart_item).to receive(:quantity=).with(5)
|
56
56
|
item = subject.add(object, 19.99, 3)
|
57
|
-
item.
|
57
|
+
expect(item).to be shopping_cart_item
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
context "item is already in cart" do
|
62
62
|
before do
|
63
|
-
subject.
|
63
|
+
allow(subject).to receive(:item_for).with(object).and_return(shopping_cart_item)
|
64
64
|
end
|
65
65
|
|
66
66
|
it "updates the quantity for the item non-cumulatively" do
|
67
|
-
shopping_cart_item.
|
67
|
+
expect(shopping_cart_item).to receive(:quantity=).with(3) # not 5
|
68
68
|
subject.add(object, 19.99, 3, false)
|
69
69
|
end
|
70
70
|
end
|
@@ -72,29 +72,47 @@ describe ActiveRecord::Acts::ShoppingCart::Collection do
|
|
72
72
|
|
73
73
|
describe :clear do
|
74
74
|
before do
|
75
|
-
subject.shopping_cart_items.
|
75
|
+
expect(subject.shopping_cart_items).to receive(:clear)
|
76
76
|
end
|
77
77
|
|
78
78
|
it "clears all the items in the cart" do
|
79
79
|
subject.clear
|
80
|
-
subject.
|
80
|
+
expect(subject.has_no_items?).to be true
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
describe "
|
84
|
+
describe "has_items?" do
|
85
85
|
context "cart has items" do
|
86
86
|
before do
|
87
|
-
subject.shopping_cart_items <<
|
87
|
+
subject.shopping_cart_items << double
|
88
|
+
end
|
89
|
+
|
90
|
+
it "returns true" do
|
91
|
+
expect(subject.has_items?).to be true
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
context "cart is empty" do
|
96
|
+
it "returns false" do
|
97
|
+
expect(subject.has_items?).to be false
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "has_no_items?" do
|
103
|
+
context "cart has items" do
|
104
|
+
before do
|
105
|
+
subject.shopping_cart_items << double
|
88
106
|
end
|
89
107
|
|
90
108
|
it "returns false" do
|
91
|
-
subject.
|
109
|
+
expect(subject.has_no_items?).to be false
|
92
110
|
end
|
93
111
|
end
|
94
112
|
|
95
113
|
context "cart is empty" do
|
96
114
|
it "returns true" do
|
97
|
-
subject.
|
115
|
+
expect(subject.has_no_items?).to be true
|
98
116
|
end
|
99
117
|
end
|
100
118
|
end
|
@@ -102,7 +120,7 @@ describe ActiveRecord::Acts::ShoppingCart::Collection do
|
|
102
120
|
describe :remove do
|
103
121
|
context "item is not on cart" do
|
104
122
|
before do
|
105
|
-
subject.
|
123
|
+
allow(subject).to receive(:item_for).with(object)
|
106
124
|
end
|
107
125
|
|
108
126
|
it "does nothing" do
|
@@ -112,19 +130,19 @@ describe ActiveRecord::Acts::ShoppingCart::Collection do
|
|
112
130
|
|
113
131
|
context "item is on cart" do
|
114
132
|
before do
|
115
|
-
subject.
|
133
|
+
allow(subject).to receive(:item_for).with(object).and_return(shopping_cart_item)
|
116
134
|
end
|
117
135
|
|
118
136
|
context "remove less items than those on cart" do
|
119
137
|
it "just updates the shopping cart item quantity" do
|
120
|
-
shopping_cart_item.
|
138
|
+
expect(shopping_cart_item).to receive(:quantity=).with(1)
|
121
139
|
subject.remove(object, 1)
|
122
140
|
end
|
123
141
|
end
|
124
142
|
|
125
143
|
context "remove more items than those on cart" do
|
126
144
|
it "removes the shopping cart item object completely" do
|
127
|
-
shopping_cart_item.
|
145
|
+
expect(shopping_cart_item).to receive(:delete)
|
128
146
|
subject.remove(object, 99)
|
129
147
|
end
|
130
148
|
end
|
@@ -134,82 +152,86 @@ describe ActiveRecord::Acts::ShoppingCart::Collection do
|
|
134
152
|
describe :subtotal do
|
135
153
|
context "cart has no items" do
|
136
154
|
before do
|
137
|
-
subject.
|
155
|
+
allow(subject).to receive(:shopping_cart_items).and_return([])
|
138
156
|
end
|
139
157
|
|
140
158
|
it "returns 0" do
|
141
|
-
subject.subtotal.
|
142
|
-
subject.subtotal.
|
159
|
+
expect(subject.subtotal).to be_an_instance_of(Money)
|
160
|
+
expect(subject.subtotal).to eq(Money.new(0))
|
143
161
|
end
|
144
162
|
end
|
145
163
|
|
146
164
|
context "cart has items" do
|
147
165
|
before do
|
148
|
-
items = [
|
149
|
-
|
166
|
+
items = [instance_double("item 1", quantity: 2, price: Money.new(3399)),
|
167
|
+
instance_double("item 2", quantity: 1, price: Money.new(4599))]
|
168
|
+
allow(subject).to receive(:shopping_cart_items).and_return(items)
|
150
169
|
end
|
151
170
|
|
152
171
|
it "returns the sum of the price * quantity for all items" do
|
153
|
-
subject.subtotal.
|
154
|
-
subject.subtotal.
|
172
|
+
expect(subject.subtotal).to be_an_instance_of(Money)
|
173
|
+
expect(subject.subtotal).to eq(Money.new(11397))
|
155
174
|
end
|
156
175
|
end
|
157
176
|
end
|
158
177
|
|
159
178
|
describe :shipping_cost do
|
160
179
|
it "returns 0" do
|
161
|
-
subject.shipping_cost.
|
162
|
-
subject.shipping_cost.
|
180
|
+
expect(subject.shipping_cost).to be_an_instance_of Money
|
181
|
+
expect(subject.shipping_cost).to eq(Money.new(0))
|
163
182
|
end
|
164
183
|
end
|
165
184
|
|
166
185
|
describe :taxes do
|
167
186
|
context "subtotal is 100" do
|
168
187
|
before do
|
169
|
-
subject.
|
188
|
+
allow(subject).to receive(:subtotal).and_return(Money.new(10_000))
|
170
189
|
end
|
171
190
|
|
172
191
|
it "returns 8.25" do
|
173
|
-
subject.taxes.
|
174
|
-
subject.taxes.
|
192
|
+
expect(subject.taxes).to be_an_instance_of Money
|
193
|
+
expect(subject.taxes).to eq(Money.new(825))
|
175
194
|
end
|
176
195
|
end
|
177
196
|
end
|
178
197
|
|
179
198
|
describe :tax_pct do
|
180
199
|
it "returns 8.25" do
|
181
|
-
subject.tax_pct.
|
200
|
+
expect(subject.tax_pct).to eq(8.25)
|
182
201
|
end
|
183
202
|
end
|
184
203
|
|
185
204
|
describe :total do
|
186
205
|
before do
|
187
|
-
subject
|
188
|
-
|
189
|
-
|
206
|
+
allow(subject).to receive_messages(
|
207
|
+
subtotal: Money.new(1099),
|
208
|
+
taxes: Money.new(1399),
|
209
|
+
shipping_cost: Money.new(1299)
|
210
|
+
)
|
190
211
|
end
|
191
212
|
|
192
213
|
it "returns subtotal + taxes + shipping_cost" do
|
193
|
-
subject.total.
|
194
|
-
subject.total.
|
214
|
+
expect(subject.total).to be_an_instance_of Money
|
215
|
+
expect(subject.total).to eq(Money.new(3797))
|
195
216
|
end
|
196
217
|
end
|
197
218
|
|
198
219
|
describe :total_unique_items do
|
199
220
|
context "cart has no items" do
|
200
221
|
it "returns 0" do
|
201
|
-
subject.total_unique_items.
|
222
|
+
expect(subject.total_unique_items).to eq(0)
|
202
223
|
end
|
203
224
|
end
|
204
225
|
|
205
226
|
context "cart has some items" do
|
206
227
|
before do
|
207
|
-
items = [
|
208
|
-
|
228
|
+
items = [instance_double("item 1", quantity: 2, price: 33.99),
|
229
|
+
instance_double("item 2", quantity: 1, price: 45.99)]
|
230
|
+
allow(subject).to receive(:shopping_cart_items).and_return(items)
|
209
231
|
end
|
210
232
|
|
211
233
|
it "returns the sum of the quantities of all shopping cart items" do
|
212
|
-
subject.total_unique_items.
|
234
|
+
expect(subject.total_unique_items).to eq(3)
|
213
235
|
end
|
214
236
|
end
|
215
237
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "../../../../spec_helper")
|
2
2
|
|
3
3
|
describe ActiveRecord::Acts::ShoppingCart::Item do
|
4
4
|
let(:klass) do
|
@@ -7,35 +7,35 @@ describe ActiveRecord::Acts::ShoppingCart::Item do
|
|
7
7
|
klass
|
8
8
|
end
|
9
9
|
|
10
|
-
let(:shopping_cart_items) {
|
10
|
+
let(:shopping_cart_items) { double }
|
11
11
|
|
12
12
|
let(:subject) do
|
13
13
|
subject = klass.new
|
14
|
-
subject.
|
14
|
+
allow(subject).to receive(:shopping_cart_items).and_return(shopping_cart_items)
|
15
15
|
subject
|
16
16
|
end
|
17
17
|
|
18
|
-
let(:object) {
|
19
|
-
let(:item) {
|
18
|
+
let(:object) { instance_double("object", id: 1) }
|
19
|
+
let(:item) { instance_double("item", subtotal: 47.98, price: 23.99, quantity: 2, save: true)}
|
20
20
|
|
21
21
|
describe :item_for do
|
22
22
|
context "no cart item exists for the object" do
|
23
23
|
before do
|
24
|
-
shopping_cart_items.
|
24
|
+
expect(shopping_cart_items).to receive(:where).with(item: object).and_return([])
|
25
25
|
end
|
26
26
|
|
27
27
|
it "returns the shopping cart item object for the requested object" do
|
28
|
-
subject.item_for(object).
|
28
|
+
expect(subject.item_for(object)).to be_nil
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
32
|
context "a cart item exists for the object" do
|
33
33
|
before do
|
34
|
-
shopping_cart_items.
|
34
|
+
expect(shopping_cart_items).to receive(:where).with(item: object).and_return([item])
|
35
35
|
end
|
36
36
|
|
37
37
|
it "returns that item" do
|
38
|
-
subject.item_for(object).
|
38
|
+
expect(subject.item_for(object)).to be(item)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
@@ -43,21 +43,21 @@ describe ActiveRecord::Acts::ShoppingCart::Item do
|
|
43
43
|
describe :subtotal_for do
|
44
44
|
context "no cart item exists for the object" do
|
45
45
|
before do
|
46
|
-
subject.
|
46
|
+
expect(subject).to receive(:item_for).with(object)
|
47
47
|
end
|
48
48
|
|
49
49
|
it "returns 0" do
|
50
|
-
subject.subtotal_for(object).
|
50
|
+
expect(subject.subtotal_for(object)).to eq(0.0)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
context "the cart item exists for the object" do
|
55
55
|
before do
|
56
|
-
subject.
|
56
|
+
expect(subject).to receive(:item_for).with(object).and_return(item)
|
57
57
|
end
|
58
58
|
|
59
59
|
it "returns the subtotal for the item" do
|
60
|
-
subject.subtotal_for(object).
|
60
|
+
expect(subject.subtotal_for(object)).to eq(47.98)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
@@ -65,21 +65,21 @@ describe ActiveRecord::Acts::ShoppingCart::Item do
|
|
65
65
|
describe :quantity_for do
|
66
66
|
context "no cart item exists for the object" do
|
67
67
|
before do
|
68
|
-
subject.
|
68
|
+
expect(subject).to receive(:item_for).with(object)
|
69
69
|
end
|
70
70
|
|
71
71
|
it "returns 0" do
|
72
|
-
subject.quantity_for(object).
|
72
|
+
expect(subject.quantity_for(object)).to eq(0)
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
context "the cart item exists for the object" do
|
77
77
|
before do
|
78
|
-
subject.
|
78
|
+
expect(subject).to receive(:item_for).with(object).and_return(item)
|
79
79
|
end
|
80
80
|
|
81
81
|
it "returns the quantity for the object" do
|
82
|
-
subject.quantity_for(object).
|
82
|
+
expect(subject.quantity_for(object)).to eq(2)
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
@@ -87,11 +87,11 @@ describe ActiveRecord::Acts::ShoppingCart::Item do
|
|
87
87
|
describe :update_quantity_for do
|
88
88
|
context "the cart item exists for the object" do
|
89
89
|
before do
|
90
|
-
subject.
|
90
|
+
expect(subject).to receive(:item_for).with(object).and_return(item)
|
91
91
|
end
|
92
92
|
|
93
93
|
it "updates the item quantity to the specified quantity" do
|
94
|
-
item.
|
94
|
+
expect(item).to receive(:update_quantity).with(3)
|
95
95
|
subject.update_quantity_for(object, 3)
|
96
96
|
end
|
97
97
|
end
|
@@ -100,21 +100,21 @@ describe ActiveRecord::Acts::ShoppingCart::Item do
|
|
100
100
|
describe :price_for do
|
101
101
|
context "no cart item exists for the object" do
|
102
102
|
before do
|
103
|
-
subject.
|
103
|
+
expect(subject).to receive(:item_for).with(object)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "returns 0" do
|
107
|
-
subject.price_for(object).
|
107
|
+
expect(subject.price_for(object)).to eq(0.0)
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
111
|
context "the cart item exists for the object" do
|
112
112
|
before do
|
113
|
-
subject.
|
113
|
+
expect(subject).to receive(:item_for).with(object).and_return(item)
|
114
114
|
end
|
115
115
|
|
116
116
|
it "returns the price of the item" do
|
117
|
-
subject.price_for(object).
|
117
|
+
expect(subject.price_for(object)).to eq(23.99)
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
@@ -122,11 +122,11 @@ describe ActiveRecord::Acts::ShoppingCart::Item do
|
|
122
122
|
describe :update_price_for do
|
123
123
|
context "the cart item exists for the object" do
|
124
124
|
before do
|
125
|
-
subject.
|
125
|
+
expect(subject).to receive(:item_for).with(object).and_return(item)
|
126
126
|
end
|
127
127
|
|
128
128
|
it "updates the price on the item" do
|
129
|
-
item.
|
129
|
+
expect(item).to receive(:update_price).with(99.99)
|
130
130
|
subject.update_price_for(object, 99.99)
|
131
131
|
end
|
132
132
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) +
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "../../../../spec_helper")
|
2
2
|
|
3
3
|
describe ActiveRecord::Acts::ShoppingCartItem::InstanceMethods do
|
4
4
|
let(:klass) do
|
@@ -9,29 +9,29 @@ describe ActiveRecord::Acts::ShoppingCartItem::InstanceMethods do
|
|
9
9
|
|
10
10
|
let(:subject) do
|
11
11
|
subject = klass.new
|
12
|
-
subject.
|
12
|
+
allow(subject).to receive(:save).and_return(true)
|
13
13
|
subject
|
14
14
|
end
|
15
15
|
|
16
16
|
describe :subtotal do
|
17
17
|
it "returns the quantity * price" do
|
18
|
-
subject.
|
19
|
-
subject.subtotal.
|
18
|
+
allow(subject).to receive_messages(quantity: 2, price: 33.99)
|
19
|
+
expect(subject.subtotal).to eq(67.98)
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
23
|
describe :update_quantity do
|
24
24
|
it "updates the item quantity" do
|
25
|
-
subject.
|
26
|
-
subject.
|
25
|
+
expect(subject).to receive(:quantity=).with(5)
|
26
|
+
expect(subject).to receive(:save)
|
27
27
|
subject.update_quantity(5)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
31
|
describe :update_price do
|
32
32
|
it "updates the item price" do
|
33
|
-
subject.
|
34
|
-
subject.
|
33
|
+
expect(subject).to receive(:price=).with(55.99)
|
34
|
+
expect(subject).to receive(:save)
|
35
35
|
subject.update_price(55.99)
|
36
36
|
end
|
37
37
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,21 +1,25 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "bundler/setup"
|
3
|
+
|
1
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
2
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
3
6
|
|
4
|
-
require
|
5
|
-
|
7
|
+
require "codeclimate-test-reporter"
|
8
|
+
CodeClimate::TestReporter.start
|
6
9
|
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
10
|
+
require "simplecov"
|
11
|
+
require "rails"
|
12
|
+
require "active_record"
|
13
|
+
require "money-rails"
|
11
14
|
|
12
15
|
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
13
16
|
|
14
17
|
MoneyRails::Hooks.init
|
15
|
-
require
|
18
|
+
require "acts_as_shopping_cart"
|
16
19
|
|
17
20
|
SimpleCov.start
|
18
21
|
|
19
22
|
RSpec.configure do |config|
|
20
23
|
config.mock_with :rspec
|
24
|
+
config.raise_errors_for_deprecations!
|
21
25
|
end
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_shopping_cart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Padilla
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -30,28 +30,28 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cucumber
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: database_cleaner
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,44 +70,44 @@ dependencies:
|
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: sqlite3
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,20 +122,52 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rubocop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: codeclimate-test-reporter
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description: Simple Shopping Cart implementation
|
126
154
|
email:
|
127
|
-
- david@
|
155
|
+
- david@padilla.io
|
128
156
|
executables: []
|
129
157
|
extensions: []
|
130
158
|
extra_rdoc_files: []
|
131
159
|
files:
|
132
160
|
- ".document"
|
133
161
|
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".rubocop.yml"
|
134
164
|
- ".travis.yml"
|
165
|
+
- CHANGELOG.md
|
135
166
|
- Gemfile
|
136
167
|
- Gemfile.4.0
|
137
168
|
- Gemfile.4.1
|
138
169
|
- Gemfile.4.2
|
170
|
+
- Gemfile.5.0
|
139
171
|
- LICENSE
|
140
172
|
- README.markdown
|
141
173
|
- Rakefile
|
@@ -178,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
210
|
version: '0'
|
179
211
|
requirements: []
|
180
212
|
rubyforge_project: acts_as_shopping_cart
|
181
|
-
rubygems_version: 2.
|
213
|
+
rubygems_version: 2.5.1
|
182
214
|
signing_key:
|
183
215
|
specification_version: 4
|
184
216
|
summary: Simple Shopping Cart implementation
|