Skip to content

Commit cbbff17

Browse files
committedMay 27, 2014

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed
 

Diff for: ‎elasticsearch-persistence/lib/elasticsearch/persistence/repository.rb

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ def method_missing(method_name, *arguments, &block)
88
def respond_to?(method_name, include_private=false)
99
gateway.respond_to?(method_name) || super
1010
end
11+
12+
def respond_to_missing?(method_name, *)
13+
gateway.respond_to?(method_name) || super
14+
end
1115
end
1216

1317
module Repository

Diff for: ‎elasticsearch-persistence/test/unit/repository_module_test.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ class DummyRepository
5959
assert_equal 'snowball', repository.mappings.to_hash[:my_dummy_model][:properties][:title][:analyzer]
6060
end
6161

62+
should "correctly delegate to the gateway" do
63+
repository = DummyRepository.new
64+
assert_instance_of Method, repository.method(:index)
65+
end
66+
6267
should "proxy repository methods from the instance to the gateway" do
6368
class DummyRepository
6469
include Elasticsearch::Persistence::Repository
@@ -111,6 +116,5 @@ def serialize(document)
111116
should "configure the index name in the shortcut initializer" do
112117
assert_equal 'repository', Elasticsearch::Persistence::Repository.new.index_name
113118
end
114-
115119
end
116120
end

Diff for: ‎elasticsearch-persistence/test/unit/repository_response_results_test.rb

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ class MyDocument; end
6363
assert_respond_to subject, :each
6464
end
6565

66+
should "respond to missing" do
67+
assert_instance_of Method, subject.method(:to_a)
68+
end
69+
6670
should "yield each object with hit" do
6771
@shoulda_subject = Repository::Response::Results.new \
6872
@repository,

0 commit comments

Comments
 (0)
Please sign in to comment.