ripplr 0.0.5.beta → 0.0.6.beta
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.
- data/lib/ripplr/queryable.rb +1 -1
- data/lib/ripplr/version.rb +1 -1
- data/spec/ripplr/queryable_spec.rb +4 -4
- metadata +1 -1
data/lib/ripplr/queryable.rb
CHANGED
@@ -29,7 +29,7 @@ module Ripplr
|
|
29
29
|
end
|
30
30
|
|
31
31
|
module QueryableClassMethods
|
32
|
-
def
|
32
|
+
def search(property, query, indices=Ripplr::Indexers::Ripple)
|
33
33
|
indices.search self, "#{queryable_field(property)}: \"#{query}\""
|
34
34
|
end
|
35
35
|
|
data/lib/ripplr/version.rb
CHANGED
@@ -15,20 +15,20 @@ describe Ripplr::Queryable do
|
|
15
15
|
Then { Person.new.bucket_name.should == "people" }
|
16
16
|
end
|
17
17
|
|
18
|
-
describe "#
|
18
|
+
describe "#search" do
|
19
19
|
context "when using a field that has been defiend as queryable" do
|
20
20
|
Given (:indexer) { mock }
|
21
21
|
Given { indexer.should_receive(:search).with(Person,"first_name_text: \"Dan\"").and_return ["Dan Auerbach"] }
|
22
|
-
When (:result) { Person.
|
22
|
+
When (:result) { Person.search :first_name, "Dan", indexer }
|
23
23
|
Then { result.should == [ "Dan Auerbach" ] }
|
24
24
|
end
|
25
25
|
|
26
26
|
context "when using a field that has not been defined as queryable" do
|
27
|
-
Then { expect { Person.
|
27
|
+
Then { expect { Person.search :full_name, "val" }.to raise_error RuntimeError }
|
28
28
|
end
|
29
29
|
|
30
30
|
context "when the object does not have any queryable fields" do
|
31
|
-
Then { expect { Unqueryable.
|
31
|
+
Then { expect { Unqueryable.search :something, "what what" }.to raise_error RuntimeError }
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|