CloudSesame 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +1 -1
- data/cloud_sesame.gemspec +1 -1
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +438 -434
- data/lib/cloud_sesame/domain/base.rb +7 -3
- data/lib/cloud_sesame/query/dsl/query_methods.rb +1 -1
- data/spec/cloud_sesame/domain/base_spec.rb +15 -5
- data/spec/profiling_spec.rb +2 -0
- metadata +1 -1
@@ -104,9 +104,13 @@ module CloudSesame
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def method_missing(name, *args, &block)
|
107
|
-
builder.respond_to?(name)
|
108
|
-
|
109
|
-
|
107
|
+
if builder.respond_to?(name, true) || filter_query_scopes[name]
|
108
|
+
builder.send(name, *args, &block)
|
109
|
+
elsif searchable.respond_to?(name, true)
|
110
|
+
searchable.send(name, *args, &block)
|
111
|
+
else
|
112
|
+
super
|
113
|
+
end
|
110
114
|
end
|
111
115
|
|
112
116
|
# CONTEXT INITIALIZERS
|
@@ -268,11 +268,11 @@ module CloudSesame
|
|
268
268
|
context 'when method missing' do
|
269
269
|
let(:undefined_method) { :undefined_method }
|
270
270
|
let(:args) { [1,2,3] }
|
271
|
-
|
272
|
-
let(:builder) { subject.builder }
|
271
|
+
let(:builder) { subject.builder }
|
273
272
|
before { allow(subject).to receive(:builder).and_return(builder) }
|
273
|
+
context 'and builder resposnds to the method' do
|
274
274
|
it 'should check if builder responds to the method' do
|
275
|
-
expect(builder).to receive(:respond_to?).with(undefined_method)
|
275
|
+
expect(builder).to receive(:respond_to?).with(undefined_method, true)
|
276
276
|
subject.undefined_method rescue nil
|
277
277
|
end
|
278
278
|
it 'should call method on builder with parameters passed in' do
|
@@ -281,10 +281,20 @@ module CloudSesame
|
|
281
281
|
subject.undefined_method(*args)
|
282
282
|
end
|
283
283
|
end
|
284
|
-
|
284
|
+
context 'and scopes responds to the method' do
|
285
|
+
let(:filter_query) { { scopes: { undefined_method: nil } } }
|
286
|
+
before {
|
287
|
+
subject.context[:filter_query] = filter_query
|
288
|
+
allow(builder).to receive(undefined_method).and_return(nil)
|
289
|
+
}
|
290
|
+
it 'should call method on builder with parameters' do
|
291
|
+
expect(builder).to receive(undefined_method).with(*args)
|
292
|
+
subject.undefined_method(*args)
|
293
|
+
end
|
294
|
+
end
|
285
295
|
context 'and builder not responds to the methods but searchable do' do
|
286
296
|
it 'should check if callee existing and responds to the method' do
|
287
|
-
expect(searchable).to receive(:respond_to?).with(undefined_method)
|
297
|
+
expect(searchable).to receive(:respond_to?).with(undefined_method, true)
|
288
298
|
subject.undefined_method rescue nil
|
289
299
|
end
|
290
300
|
it 'should call method on searchable with parameters passed in' do
|
data/spec/profiling_spec.rb
CHANGED