rhoconnect 5.5.18 → 7.4.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.
@@ -1,13 +1,13 @@
1
1
  # Taken from http://github.com/voloko/redis-model
2
- require File.join(File.dirname(__FILE__),'spec_helper')
2
+ require File.join(File.dirname(__FILE__), 'spec_helper')
3
3
 
4
4
  describe Rhoconnect::StoreOrm do
5
5
 
6
6
  context "DSL" do
7
7
  class TestDSL < Rhoconnect::StoreOrm
8
8
  field :foo
9
- list :bar
10
- set :sloppy
9
+ list :bar
10
+ set :sloppy
11
11
  end
12
12
 
13
13
  before(:each) do
@@ -15,37 +15,37 @@ describe Rhoconnect::StoreOrm do
15
15
  end
16
16
 
17
17
  it "should define rw accessors for field" do
18
- @x.should respond_to(:foo)
19
- @x.should respond_to(:foo=)
18
+ expect(@x).to respond_to(:foo)
19
+ expect(@x).to respond_to(:foo=)
20
20
  end
21
21
 
22
22
  it "should define r accessor for list" do
23
- @x.should respond_to(:bar)
23
+ expect(@x).to respond_to(:bar)
24
24
  end
25
25
 
26
26
  it "should define r accessor for set" do
27
- @x.should respond_to(:sloppy)
27
+ expect(@x).to respond_to(:sloppy)
28
28
  end
29
29
 
30
30
  it "should raise error on invalid type" do
31
- lambda do
31
+ expect(lambda do
32
32
  class TestInvalidType < Rhoconnect::StoreOrm
33
33
  field :invalid, :invalid_type
34
34
  end
35
- end.should raise_error(ArgumentError, 'Unknown type invalid_type for field invalid')
35
+ end).to raise_error(ArgumentError, 'Unknown type invalid_type for field invalid')
36
36
  end
37
37
  end
38
38
 
39
39
  context "field type cast" do
40
40
  class TestType < Rhoconnect::StoreOrm
41
41
  field :foo_string, :string
42
- field :foo_json, :json
43
- field :foo_date, :datetime
44
- field :foo_int, :int
45
- field :foo_float, :float
42
+ field :foo_json, :json
43
+ field :foo_date, :datetime
44
+ field :foo_int, :int
45
+ field :foo_float, :float
46
46
 
47
- list :list_date, :datetime
48
- set :set_date, :datetime
47
+ list :list_date, :datetime
48
+ set :set_date, :datetime
49
49
  end
50
50
 
51
51
  class TestValidateType < Rhoconnect::StoreOrm
@@ -61,135 +61,135 @@ describe Rhoconnect::StoreOrm do
61
61
  before(:each) do
62
62
  Store.create
63
63
  Store.flush_all
64
+ =begin
64
65
  @xRedisMock = RSpec::Mocks::Mock.new
65
66
  @yRedisMock = RSpec::Mocks::Mock.new
66
67
  @xRedisDbMock = RSpec::Mocks::Mock.new
67
68
  @yRedisDbMock = RSpec::Mocks::Mock.new
69
+ =end
68
70
  @x = TestType.with_key(1)
69
71
  @y = TestType.with_key(1)
70
- @x.stub(:store).and_return(@xRedisMock)
71
- @y.stub(:store).and_return(@yRedisMock)
72
- @xRedisMock.stub(:db).and_return(@xRedisDbMock)
73
- @yRedisMock.stub(:db).and_return(@yRedisDbMock)
72
+ allow(@x).to receive(:store).and_return(@xRedisMock)
73
+ allow(@y).to receive(:store).and_return(@yRedisMock)
74
+ allow(@xRedisMock).to receive(:db).and_return(@xRedisDbMock)
75
+ allow(@yRedisMock).to receive(:db).and_return(@yRedisDbMock)
74
76
  end
75
77
 
76
78
  it "should create with string id" do
77
79
  @x = TestType.create(:id => 'test')
78
- @x.id.should == 'test'
80
+ expect(@x.id).to eq('test')
79
81
  end
80
82
 
81
83
  it "should create with auto-increment id" do
82
84
  @x = TestType.create
83
85
  @x1 = TestType.create
84
- @x1.id.should == @x.id + 1
86
+ expect(@x1.id).to eq(@x.id + 1)
85
87
  end
86
88
 
87
89
  it "should raise ArgumentError on create with duplicate id" do
88
90
  @x = TestType.create(:id => 'test1')
89
- lambda { TestType.create(:id => 'test1') }.should
90
- raise_error(ArgumentError, "Record already exists for 'test1'")
91
+ expect(lambda {TestType.create(:id => 'test1') }).to raise_error(ArgumentError, "Record already exists for 'test1'")
91
92
  end
92
93
 
93
94
  it "should validate_presence_of v_field" do
94
- lambda { TestValidateType.create(:id => 'test2') }.should
95
- raise_error(ArgumentError, "Missing required field 'v_field'")
95
+ expect(lambda {TestValidateType.create(:id => 'test2')}).to raise_error(ArgumentError, "Missing required field 'v_field'")
96
96
  end
97
97
 
98
98
  it "should load with attributes set" do
99
99
  TestLoadType.create(:id => 'test2')
100
- @x = TestLoadType.load('test2',{:foo => 'bar'})
101
- @x.foo.should == 'bar'
100
+ @x = TestLoadType.load('test2', {:foo => 'bar'})
101
+ expect(@x.foo).to eq('bar')
102
102
  end
103
103
 
104
104
  it "should save string as is" do
105
- @xRedisMock.should_receive(:put_value).with('test_type:1:foo_string', 'xxx')
106
- @yRedisMock.should_receive(:get_value).with('test_type:1:foo_string').and_return('xxx')
105
+ expect(@xRedisMock).to receive(:put_value).with('test_type:1:foo_string', 'xxx')
106
+ expect(@yRedisMock).to receive(:get_value).with('test_type:1:foo_string').and_return('xxx')
107
107
  @x.foo_string = 'xxx'
108
- @y.foo_string.should be_instance_of(String)
108
+ expect(@y.foo_string).to be_instance_of(String)
109
109
  end
110
110
 
111
111
  it "should marshal integer fields" do
112
- @xRedisMock.should_receive(:put_value).with('test_type:1:foo_int', '12')
113
- @yRedisMock.should_receive(:get_value).with('test_type:1:foo_int').and_return('12')
112
+ expect(@xRedisMock).to receive(:put_value).with('test_type:1:foo_int', '12')
113
+ expect(@yRedisMock).to receive(:get_value).with('test_type:1:foo_int').and_return('12')
114
114
  @x.foo_int = 12
115
- @y.foo_int.should be_kind_of(Integer)
116
- @y.foo_int.should == 12
115
+ expect(@y.foo_int).to be_kind_of(Integer)
116
+ expect(@y.foo_int).to eq(12)
117
117
  end
118
118
 
119
119
  it "should marshal float fields" do
120
- @xRedisMock.should_receive(:put_value).with('test_type:1:foo_float', '12.1')
121
- @yRedisMock.should_receive(:get_value).with('test_type:1:foo_float').and_return('12.1')
120
+ expect(@xRedisMock).to receive(:put_value).with('test_type:1:foo_float', '12.1')
121
+ expect(@yRedisMock).to receive(:get_value).with('test_type:1:foo_float').and_return('12.1')
122
122
  @x.foo_float = 12.1
123
- @y.foo_float.should be_kind_of(Float)
124
- @y.foo_float.should == 12.1
123
+ expect(@y.foo_float).to be_kind_of(Float)
124
+ expect(@y.foo_float).to eq(12.1)
125
125
  end
126
126
 
127
127
  it "should marshal datetime fields" do
128
128
  time = DateTime.now
129
- str = time.strftime('%FT%T%z')
130
- @xRedisMock.should_receive(:put_value).with('test_type:1:foo_date', str)
131
- @yRedisMock.should_receive(:get_value).with('test_type:1:foo_date').and_return(str)
129
+ str = time.strftime('%FT%T%z')
130
+ expect(@xRedisMock).to receive(:put_value).with('test_type:1:foo_date', str)
131
+ expect(@yRedisMock).to receive(:get_value).with('test_type:1:foo_date').and_return(str)
132
132
  @x.foo_date = time
133
- @y.foo_date.should be_kind_of(DateTime)
134
- @y.foo_date.should.to_s == time.to_s
133
+ expect(@y.foo_date).to be_kind_of(DateTime)
134
+ expect(@y.foo_date.to_s).to eq(time.to_s)
135
135
  end
136
136
 
137
137
  it "should marshal json structs" do
138
138
  data = {'foo' => 'bar', 'x' => 2}
139
- str = JSON.dump(data)
140
- @xRedisMock.should_receive(:put_value).with('test_type:1:foo_json', str)
141
- @yRedisMock.should_receive(:get_value).with('test_type:1:foo_json').and_return(str)
139
+ str = JSON.dump(data)
140
+ expect(@xRedisMock).to receive(:put_value).with('test_type:1:foo_json', str)
141
+ expect(@yRedisMock).to receive(:get_value).with('test_type:1:foo_json').and_return(str)
142
142
  @x.foo_json = data
143
- @y.foo_json.should be_kind_of(Hash)
144
- @y.foo_json.should.inspect == data.inspect
143
+ expect(@y.foo_json).to be_kind_of(Hash)
144
+ expect(@y.foo_json.inspect).to eq(data.inspect)
145
145
  end
146
146
 
147
147
  it "should return nil for empty fields" do
148
- @xRedisMock.should_receive(:get_value).with('test_type:1:foo_date').and_return(nil)
149
- @x.foo_date.should be_nil
148
+ expect(@xRedisMock).to receive(:get_value).with('test_type:1:foo_date').and_return(nil)
149
+ expect(@x.foo_date).to be_nil
150
150
  end
151
151
 
152
152
  it "should marshal list values" do
153
153
  data = DateTime.now
154
- str = data.strftime('%FT%T%z')
155
-
156
- @xRedisDbMock.should_receive('rpush').with('test_type:1:list_date', str)
157
- @xRedisDbMock.should_receive('lset').with('test_type:1:list_date', 1, str)
158
- @xRedisDbMock.should_receive('exists').with('test_type:1:list_date', str)
159
- @xRedisDbMock.should_receive('lrem').with('test_type:1:list_date', 0, str)
160
- @xRedisDbMock.should_receive('lpush').with('test_type:1:list_date', str)
161
- @xRedisDbMock.should_receive('lrange').with('test_type:1:list_date', 0, 1).and_return([str])
162
- @xRedisDbMock.should_receive('rpop').with('test_type:1:list_date').and_return(str)
163
- @xRedisDbMock.should_receive('lpop').with('test_type:1:list_date').and_return(str)
164
- @xRedisDbMock.should_receive('lindex').with('test_type:1:list_date', 0).and_return(str)
154
+ str = data.strftime('%FT%T%z')
155
+
156
+ expect(@xRedisDbMock).to receive('rpush').with('test_type:1:list_date', str)
157
+ expect(@xRedisDbMock).to receive('lset').with('test_type:1:list_date', 1, str)
158
+ expect(@xRedisDbMock).to receive('exists').with('test_type:1:list_date', str)
159
+ expect(@xRedisDbMock).to receive('lrem').with('test_type:1:list_date', 0, str)
160
+ expect(@xRedisDbMock).to receive('lpush').with('test_type:1:list_date', str)
161
+ expect(@xRedisDbMock).to receive('lrange').with('test_type:1:list_date', 0, 1).and_return([str])
162
+ expect(@xRedisDbMock).to receive('rpop').with('test_type:1:list_date').and_return(str)
163
+ expect(@xRedisDbMock).to receive('lpop').with('test_type:1:list_date').and_return(str)
164
+ expect(@xRedisDbMock).to receive('lindex').with('test_type:1:list_date', 0).and_return(str)
165
165
  @x.list_date << data
166
166
  @x.list_date[1] = data
167
167
  @x.list_date.include?(data)
168
168
  @x.list_date.remove(0, data)
169
169
  @x.list_date.push_head(data)
170
- @x.list_date[0].should be_kind_of(DateTime)
171
- @x.list_date[0, 1][0].should be_kind_of(DateTime)
172
- @x.list_date.pop_tail.should be_kind_of(DateTime)
173
- @x.list_date.pop_head.should be_kind_of(DateTime)
170
+ expect(@x.list_date[0]).to be_kind_of(DateTime)
171
+ expect(@x.list_date[0, 1][0]).to be_kind_of(DateTime)
172
+ expect(@x.list_date.pop_tail).to be_kind_of(DateTime)
173
+ expect(@x.list_date.pop_head).to be_kind_of(DateTime)
174
174
  end
175
175
 
176
176
  it "should marshal set values" do
177
177
  data = DateTime.now
178
- str = data.strftime('%FT%T%z')
178
+ str = data.strftime('%FT%T%z')
179
179
 
180
- @xRedisDbMock.should_receive('sadd').with('test_type:1:set_date', str)
181
- @xRedisDbMock.should_receive('srem').with('test_type:1:set_date', str)
182
- @xRedisDbMock.should_receive('sismember').with('test_type:1:set_date', str)
183
- @xRedisDbMock.should_receive('smembers').with('test_type:1:set_date').and_return([str])
180
+ expect(@xRedisDbMock).to receive('sadd').with('test_type:1:set_date', str)
181
+ expect(@xRedisDbMock).to receive('srem').with('test_type:1:set_date', str)
182
+ expect(@xRedisDbMock).to receive('sismember').with('test_type:1:set_date', str)
183
+ expect(@xRedisDbMock).to receive('smembers').with('test_type:1:set_date').and_return([str])
184
184
  @x.set_date << data
185
185
  @x.set_date.delete(data)
186
186
  @x.set_date.include?(data)
187
- @x.set_date.members[0].should be_kind_of(DateTime)
187
+ expect(@x.set_date.members[0]).to be_kind_of(DateTime)
188
188
  end
189
189
 
190
190
  it "should handle empty members" do
191
- @xRedisDbMock.stub(:smembers).and_return(nil)
192
- @x.set_date.members.should == []
191
+ allow(@xRedisDbMock).to receive(:smembers).and_return(nil)
192
+ expect(@x.set_date.members).to eq([])
193
193
  end
194
194
  end
195
195
 
@@ -201,25 +201,26 @@ describe Rhoconnect::StoreOrm do
201
201
  end
202
202
 
203
203
  before do
204
- @redisMock = RSpec::Mocks::Mock.new
204
+ #@redisMock = RSpec::Mocks::Mock.new
205
+ @redisMock
205
206
  @x = TestIncrements.with_key(1)
206
- @x.stub(:store).and_return(@redisMock)
207
+ allow(@x).to receive(:store).and_return(@redisMock)
207
208
  end
208
209
 
209
210
  it "should send INCR when #increment! is called on an integer" do
210
- @redisMock.should_receive(:update_count).with("test_increments:1:foo", 1)
211
+ expect(@redisMock).to receive(:update_count).with("test_increments:1:foo", 1)
211
212
  @x.increment!(:foo)
212
213
  end
213
214
 
214
215
  it "should send DECR when #decrement! is called on an integer" do
215
- @redisMock.should_receive(:update_count).with("test_increments:1:foo", -1)
216
+ expect(@redisMock).to receive(:update_count).with("test_increments:1:foo", -1)
216
217
  @x.decrement!(:foo)
217
218
  end
218
219
 
219
220
  it "should raise an ArgumentError when called on non-integers" do
220
221
  [:bar, :baz].each do |f|
221
- lambda{@x.increment!(f)}.should raise_error(ArgumentError)
222
- lambda{@x.decrement!(f)}.should raise_error(ArgumentError)
222
+ expect(lambda {@x.increment!(f)}).to raise_error(ArgumentError)
223
+ expect(lambda {@x.decrement!(f)}).to raise_error(ArgumentError)
223
224
  end
224
225
  end
225
226
  end
@@ -227,48 +228,50 @@ describe Rhoconnect::StoreOrm do
227
228
  context "redis commands" do
228
229
  class TestCommands < Rhoconnect::StoreOrm
229
230
  field :foo
230
- list :bar
231
- set :sloppy
231
+ list :bar
232
+ set :sloppy
232
233
  end
233
234
 
234
235
  before(:each) do
235
- @redisMock = RSpec::Mocks::Mock.new
236
- @redisDbMock = RSpec::Mocks::Mock.new
236
+ # @redisMock = RSpec::Mocks::Mock.new
237
+ # @redisDbMock = RSpec::Mocks::Mock.new
238
+ @redisMock
239
+ @redisDbMock
237
240
  @x = TestCommands.with_key(1)
238
- @x.stub(:store).and_return(@redisMock)
239
- @redisMock.stub(:db).and_return(@redisDbMock)
241
+ allow(@x).to receive(:store).and_return(@redisMock)
242
+ allow(@redisMock).to receive(:db).and_return(@redisDbMock)
240
243
  end
241
244
 
242
245
  it "should send GET on field read" do
243
- @redisMock.should_receive(:get_value).with('test_commands:1:foo')
246
+ expect(@redisMock).to receive(:get_value).with('test_commands:1:foo')
244
247
  @x.foo
245
248
  end
246
249
 
247
250
  it "should send SET on field write" do
248
- @redisMock.should_receive(:put_value).with('test_commands:1:foo', 'bar')
251
+ expect(@redisMock).to receive(:put_value).with('test_commands:1:foo', 'bar')
249
252
  @x.foo = 'bar'
250
253
  end
251
254
 
252
255
  it "should send RPUSH on list <<" do
253
- @redisDbMock.should_receive(:rpush).with('test_commands:1:bar', 'bar')
256
+ expect(@redisDbMock).to receive(:rpush).with('test_commands:1:bar', 'bar')
254
257
  @x.bar << 'bar'
255
258
  end
256
259
 
257
260
  it "should send SADD on set <<" do
258
- @redisDbMock.should_receive(:sadd).with('test_commands:1:sloppy', 'bar')
261
+ expect(@redisDbMock).to receive(:sadd).with('test_commands:1:sloppy', 'bar')
259
262
  @x.sloppy << 'bar'
260
263
  end
261
264
 
262
265
  it "should delete separate fields" do
263
- @redisMock.should_receive(:delete_value).with('test_commands:1:foo')
266
+ expect(@redisMock).to receive(:delete_value).with('test_commands:1:foo')
264
267
  @x.delete :foo
265
268
  end
266
269
 
267
270
  it "should delete all field" do
268
- @redisMock.should_receive(:delete_value).with('test_commands:1:foo')
269
- @redisMock.should_receive(:delete_value).with('test_commands:1:rho__id')
270
- @redisMock.should_receive(:delete_value).with('test_commands:1:bar')
271
- @redisMock.should_receive(:delete_value).with('test_commands:1:sloppy')
271
+ expect(@redisMock).to receive(:delete_value).with('test_commands:1:foo')
272
+ expect(@redisMock).to receive(:delete_value).with('test_commands:1:rho__id')
273
+ expect(@redisMock).to receive(:delete_value).with('test_commands:1:bar')
274
+ expect(@redisMock).to receive(:delete_value).with('test_commands:1:sloppy')
272
275
  @x.delete
273
276
  end
274
277
  end
data/spec/store_spec.rb CHANGED
@@ -5,22 +5,22 @@ describe "Store" do
5
5
 
6
6
  describe "store methods" do
7
7
  it "should create proper connection class" do
8
- Store.get_store(0).db.class.name.should match(/Redis/)
8
+ expect(Store.get_store(0).db.class.name).to match(/Redis/)
9
9
  end
10
10
 
11
11
  it "should create redis connection based on ENV" do
12
12
  ENV[REDIS_URL] = 'redis://localhost:6379'
13
- Redis.should_receive(:connect).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).exactly(5).times.and_return { Redis.new }
13
+ expect(Redis).to receive(:new).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).exactly(1).times.and_call_original
14
14
  Store.nullify
15
- Store.num_stores.should == 0
15
+ expect(Store.num_stores).to eq(0)
16
16
  Store.create
17
- Store.get_store(0).db.should_not == nil
17
+ expect(Store.get_store(0).db).not_to be_nil
18
18
  ENV.delete(REDIS_URL)
19
19
  end
20
20
 
21
21
  it "should create redis connection based on REDISTOGO_URL ENV" do
22
22
  ENV[REDISTOGO_URL] = 'redis://localhost:6379'
23
- Redis.should_receive(:connect).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).exactly(5).times.and_return { Redis.new }
23
+ expect(Redis).to receive(:new).with(:url => 'redis://localhost:6379', :thread_safe => true, :timeout => Rhoconnect.redis_timeout).exactly(1).and_call_original
24
24
  Store.nullify
25
25
  Store.create
26
26
  Store.get_store(0).db.should_not == nil
@@ -75,7 +75,7 @@ describe "Store" do
75
75
  Store.update_count('mydata', -5)
76
76
  Store.get_value('mydata').to_i.should == 16
77
77
  Store.delete_value('mydata')
78
- Store.exists?('mydata').should be_false
78
+ Store.exists?('mydata').should be false
79
79
  end
80
80
 
81
81
  it "should delete_objects with simple data and verify that srem is called only on affected fields" do
@@ -288,7 +288,7 @@ describe "Store" do
288
288
  doc = "locked_data"
289
289
  lock = Time.now.to_i+3
290
290
  Store.get_store(0).db.set "lock:#{doc}", lock
291
- Store.get_store(0).should_receive(:sleep).at_least(:once).with(1).and_return { sleep 1; Store.release_lock(doc,lock); }
291
+ expect(Store.get_store(0)).to receive(:sleep).at_least(:once).with(1) { sleep 1; Store.release_lock(doc,lock); }
292
292
  Store.get_lock(doc,4)
293
293
  end
294
294
 
@@ -318,7 +318,7 @@ describe "Store" do
318
318
  doc = "locked_data"
319
319
  Rhoconnect.lock_duration = 2
320
320
  Store.get_lock(doc)
321
- Store.get_store(0).should_receive(:sleep).at_least(1).times.with(1).and_return { sleep 1 }
321
+ expect(Store.get_store(0)).to receive(:sleep).at_least(1).times.with(1) { sleep 1 }
322
322
  Store.get_lock(doc)
323
323
  Rhoconnect.lock_duration = nil
324
324
  end
@@ -345,8 +345,8 @@ describe "Store" do
345
345
 
346
346
  it "should not fail to rename if key doesn't exist" do
347
347
  Store.rename('key1','key2')
348
- Store.exists?('key1').should be_false
349
- Store.exists?('key2').should be_false
348
+ Store.exists?('key1').should be false
349
+ Store.exists?('key2').should be false
350
350
  end
351
351
 
352
352
  it "should raise ArgumentError on put_data with invalid data" do
@@ -366,9 +366,9 @@ describe "Store" do
366
366
  Store.put_object(:md, key1, data1)
367
367
  Store.put_object(:md, key2, data2)
368
368
  Store.keys(:md).should == []
369
- Store.exists?("#{:md}:#{docindex1}").should be_true
370
- Store.exists?("#{:md}:#{docindex2}").should be_true
371
- Store.exists?("#{:md}:indices").should be_true
369
+ Store.exists?("#{:md}:#{docindex1}").should be true
370
+ Store.exists?("#{:md}:#{docindex2}").should be true
371
+ Store.exists?("#{:md}:indices").should be true
372
372
  Store.get_store(0).db.hkeys("#{:md}:indices").should == ["#{docindex1}", "#{docindex2}"]
373
373
  Store.get_store(0).db.hvals("#{:md}:indices").should == ["#{:md}:#{docindex1}", "#{:md}:#{docindex2}"]
374
374
  end
@@ -396,20 +396,20 @@ describe "Store" do
396
396
  Store.put_tmp_data(:md, {key1 => data1})
397
397
  Store.put_tmp_data(:md, {key2 => data2}, true)
398
398
 
399
- Store.exists?("#{:md}:#{docindex1}").should be_true
400
- Store.exists?("#{:md}:#{docindex2}").should be_true
401
- Store.exists?("#{:md}:indices").should be_true
399
+ Store.exists?("#{:md}:#{docindex1}").should be true
400
+ Store.exists?("#{:md}:#{docindex2}").should be true
401
+ Store.exists?("#{:md}:indices").should be true
402
402
  Store.get_store(0).db.ttl("#{:md}:#{docindex1}").should == Rhoconnect.store_key_ttl
403
403
  Store.get_store(0).db.ttl("#{:md}:#{docindex2}").should == Rhoconnect.store_key_ttl
404
404
  Store.get_store(0).db.ttl("#{:md}:indices").should == Rhoconnect.store_key_ttl
405
405
 
406
406
  Store.rename_tmp_data(:md, :md_perm)
407
- Store.exists?("#{:md}:#{docindex1}").should be_false
408
- Store.exists?("#{:md}:#{docindex2}").should be_false
409
- Store.exists?("#{:md}:indices").should be_false
410
- Store.exists?("#{:md_perm}:#{docindex1}").should be_true
411
- Store.exists?("#{:md_perm}:#{docindex2}").should be_true
412
- Store.exists?("#{:md_perm}:indices").should be_true
407
+ Store.exists?("#{:md}:#{docindex1}").should be false
408
+ Store.exists?("#{:md}:#{docindex2}").should be false
409
+ Store.exists?("#{:md}:indices").should be false
410
+ Store.exists?("#{:md_perm}:#{docindex1}").should be true
411
+ Store.exists?("#{:md_perm}:#{docindex2}").should be true
412
+ Store.exists?("#{:md_perm}:indices").should be true
413
413
  Store.get_store(0).db.ttl("#{:md_perm}:#{docindex1}").should == -1
414
414
  Store.get_store(0).db.ttl("#{:md_perm}:#{docindex2}").should == -1
415
415
  Store.get_store(0).db.ttl("#{:md_perm}:indices").should == -1
@@ -473,4 +473,4 @@ describe "Store" do
473
473
  end
474
474
  end
475
475
  end
476
- end
476
+ end
data/spec/user_spec.rb CHANGED
@@ -90,8 +90,8 @@ describe "User" do
90
90
 
91
91
  describe "User Stats" do
92
92
 
93
- before(:all) do
94
- Store.stub(:lock).and_yield
93
+ before(:each) do
94
+ allow(Store).to receive(:lock).and_yield
95
95
  end
96
96
 
97
97
  it "should increment user stats on create" do
@@ -114,4 +114,4 @@ describe "User" do
114
114
  Rhoconnect.stats = false
115
115
  end
116
116
  end
117
- end
117
+ end