cartman 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,9 +26,6 @@ module Cartman
26
26
  @@redis.srem key, item._id
27
27
  @@redis.srem index_key, "#{item.type}:#{item.id}"
28
28
  @@redis.del index_key_for(item)
29
- index_keys.each do |key|
30
- @@redis.del key
31
- end
32
29
  touch
33
30
  end
34
31
 
@@ -1,3 +1,3 @@
1
1
  module Cartman
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
@@ -58,6 +58,16 @@ describe Cartman do
58
58
  Cartman.config.redis.sismember(cart.send(:key), item_id).should be_false
59
59
  Cartman.config.redis.exists("cartman:line_item:#{item_id}").should be_false
60
60
  end
61
+
62
+ it "should not delete the indecies for other items" do
63
+ item = cart.add_item(id: 17, type: "Bottle", name: "Bordeux", unit_cost: 92.12, quantity: 2)
64
+ item2 = cart.add_item(id: 18, type: "Bottle", name: "Bordeux", unit_cost: 92.12, quantity: 2)
65
+ Cartman.config.redis.exists("cartman:cart:1:index:Bottle:17").should be_true
66
+ Cartman.config.redis.exists("cartman:cart:1:index:Bottle:18").should be_true
67
+ cart.remove_item(item)
68
+ Cartman.config.redis.exists("cartman:cart:1:index:Bottle:17").should be_false
69
+ Cartman.config.redis.exists("cartman:cart:1:index:Bottle:18").should be_true
70
+ end
61
71
  end
62
72
 
63
73
  describe "#items" do
@@ -204,6 +214,7 @@ describe Cartman do
204
214
  it "should rename the key, and index_key if it exists" do
205
215
  cart.add_item(id: 17, type: "Bottle", name: "Bordeux", unit_cost: 92.12, cost_in_cents: 18424, quantity: 2)
206
216
  cart.reassign(2)
217
+ cart.items.size.should be(1)
207
218
  Cartman.config.redis.exists("cartman:cart:1").should be_false
208
219
  Cartman.config.redis.exists("cartman:cart:1:index").should be_false
209
220
  Cartman.config.redis.exists("cartman:cart:1:index:Bottle:17").should be_false
@@ -213,6 +224,7 @@ describe Cartman do
213
224
  cart.send(:key)[-1].should eq("2")
214
225
  cart.add_item(id: 18, type: "Bottle", name: "Bordeux", unit_cost: 92.12, cost_in_cents: 18424, quantity: 2)
215
226
  cart.reassign(1)
227
+ cart.items.size.should be(2)
216
228
  Cartman.config.redis.exists("cartman:cart:2").should be_false
217
229
  Cartman.config.redis.exists("cartman:cart:2:index").should be_false
218
230
  Cartman.config.redis.exists("cartman:cart:1").should be_true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-31 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
@@ -81,7 +81,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
81
  version: '0'
82
82
  segments:
83
83
  - 0
84
- hash: -2016413100471598065
84
+ hash: -738931914198852373
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
@@ -90,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  version: '0'
91
91
  segments:
92
92
  - 0
93
- hash: -2016413100471598065
93
+ hash: -738931914198852373
94
94
  requirements: []
95
95
  rubyforge_project:
96
96
  rubygems_version: 1.8.23