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.
- checksums.yaml +4 -4
- data/Gemfile +18 -11
- data/Gemfile.lock +178 -100
- data/README.md +2 -0
- data/Rakefile +4 -3
- data/commands/dtach/dtach_install.rb +29 -24
- data/commands/rhoconnect/start.rb +5 -4
- data/generators/templates/application/rcgemfile +1 -1
- data/lib/rhoconnect/model/helpers/find_duplicates_on_update.rb +1 -1
- data/lib/rhoconnect/ping/fcm.rb +74 -0
- data/lib/rhoconnect/ping.rb +1 -1
- data/lib/rhoconnect/store.rb +3 -3
- data/lib/rhoconnect/version.rb +1 -1
- data/rhoconnect.gemspec +15 -11
- data/spec/api/client/get_client_params_spec.rb +4 -0
- data/spec/apps/rhotestapp/models/ruby/sample_adapter.rb +1 -1
- data/spec/client_sync_spec.rb +7 -7
- data/spec/dynamic_adapter_spec.rb +13 -13
- data/spec/generator/generator_spec.rb +7 -7
- data/spec/jobs/ping_job_spec.rb +229 -105
- data/spec/perf/perf_spec_helper.rb +5 -5
- data/spec/ping/apple_spec.rb +24 -26
- data/spec/ping/fcm_spec.rb +116 -0
- data/spec/ping/gcm_spec.rb +27 -29
- data/spec/ping/rhoconnect_push_spec.rb +13 -13
- data/spec/rhoconnect_spec.rb +2 -2
- data/spec/server/cors_spec.rb +22 -22
- data/spec/server/server_spec.rb +308 -310
- data/spec/server/stats_spec.rb +7 -7
- data/spec/server/x_domain_session_wrapper_spec.rb +40 -40
- data/spec/source_adapter_spec.rb +2 -2
- data/spec/source_sync_spec.rb +4 -4
- data/spec/spec_helper.rb +8 -8
- data/spec/stats/record_spec.rb +7 -7
- data/spec/store_orm_spec.rb +97 -94
- data/spec/store_spec.rb +23 -23
- data/spec/user_spec.rb +3 -3
- metadata +98 -27
data/spec/store_orm_spec.rb
CHANGED
@@ -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
|
10
|
-
set
|
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.
|
19
|
-
@x.
|
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.
|
23
|
+
expect(@x).to respond_to(:bar)
|
24
24
|
end
|
25
25
|
|
26
26
|
it "should define r accessor for set" do
|
27
|
-
@x.
|
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.
|
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,
|
43
|
-
field :foo_date,
|
44
|
-
field :foo_int,
|
45
|
-
field :foo_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
|
48
|
-
set
|
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.
|
71
|
-
@y.
|
72
|
-
@xRedisMock.
|
73
|
-
@yRedisMock.
|
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.
|
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.
|
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 {
|
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 {
|
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.
|
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.
|
106
|
-
@yRedisMock.
|
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.
|
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.
|
113
|
-
@yRedisMock.
|
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.
|
116
|
-
@y.foo_int.
|
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.
|
121
|
-
@yRedisMock.
|
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.
|
124
|
-
@y.foo_float.
|
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
|
130
|
-
@xRedisMock.
|
131
|
-
@yRedisMock.
|
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.
|
134
|
-
@y.foo_date.
|
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
|
140
|
-
@xRedisMock.
|
141
|
-
@yRedisMock.
|
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.
|
144
|
-
@y.foo_json.
|
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.
|
149
|
-
@x.foo_date.
|
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
|
155
|
-
|
156
|
-
@xRedisDbMock.
|
157
|
-
@xRedisDbMock.
|
158
|
-
@xRedisDbMock.
|
159
|
-
@xRedisDbMock.
|
160
|
-
@xRedisDbMock.
|
161
|
-
@xRedisDbMock.
|
162
|
-
@xRedisDbMock.
|
163
|
-
@xRedisDbMock.
|
164
|
-
@xRedisDbMock.
|
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].
|
171
|
-
@x.list_date[0, 1][0].
|
172
|
-
@x.list_date.pop_tail.
|
173
|
-
@x.list_date.pop_head.
|
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
|
178
|
+
str = data.strftime('%FT%T%z')
|
179
179
|
|
180
|
-
@xRedisDbMock.
|
181
|
-
@xRedisDbMock.
|
182
|
-
@xRedisDbMock.
|
183
|
-
@xRedisDbMock.
|
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].
|
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.
|
192
|
-
@x.set_date.members.
|
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
|
-
|
204
|
+
#@redisMock = RSpec::Mocks::Mock.new
|
205
|
+
@redisMock
|
205
206
|
@x = TestIncrements.with_key(1)
|
206
|
-
@x.
|
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.
|
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.
|
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)}.
|
222
|
-
lambda{@x.decrement!(f)}.
|
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
|
231
|
-
set
|
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.
|
239
|
-
@redisMock.
|
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.
|
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.
|
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.
|
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.
|
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.
|
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.
|
269
|
-
@redisMock.
|
270
|
-
@redisMock.
|
271
|
-
@redisMock.
|
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.
|
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.
|
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.
|
15
|
+
expect(Store.num_stores).to eq(0)
|
16
16
|
Store.create
|
17
|
-
Store.get_store(0).db.
|
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.
|
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
|
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).
|
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).
|
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
|
349
|
-
Store.exists?('key2').should
|
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
|
370
|
-
Store.exists?("#{:md}:#{docindex2}").should
|
371
|
-
Store.exists?("#{:md}:indices").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
|
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
|
400
|
-
Store.exists?("#{:md}:#{docindex2}").should
|
401
|
-
Store.exists?("#{:md}:indices").should
|
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
|
408
|
-
Store.exists?("#{:md}:#{docindex2}").should
|
409
|
-
Store.exists?("#{:md}:indices").should
|
410
|
-
Store.exists?("#{:md_perm}:#{docindex1}").should
|
411
|
-
Store.exists?("#{:md_perm}:#{docindex2}").should
|
412
|
-
Store.exists?("#{:md_perm}:indices").should
|
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(:
|
94
|
-
Store.
|
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
|