Skip to content

Commit 8404aaa

Browse files
indirectpicandocodigo
authored andcommitted
create failing spec for keyword args proxy
when the proxy fails to forward keywoard arguments, the error for methods that only accept keyword arguments looks like this: ArgumentError: wrong number of arguments (given 1, expected 0)
1 parent 2e33f22 commit 8404aaa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

elasticsearch-model/spec/elasticsearch/model/proxy_spec.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def bar
3131
'insta barr'
3232
end
3333

34+
def keyword_method(foo: 'default value')
35+
foo
36+
end
37+
3438
def as_json(options)
3539
{foo: 'bar'}
3640
end
@@ -98,7 +102,6 @@ def changes_to_save
98102
end
99103

100104
context 'when instances are cloned' do
101-
102105
let!(:model) do
103106
DummyProxyModel.new
104107
end
@@ -121,4 +124,9 @@ def changes_to_save
121124
expect(duplicate).to eq(duplicate_target)
122125
end
123126
end
127+
128+
it 'forwards keyword arguments to target methods' do
129+
expect(DummyProxyModel.new.__elasticsearch__.keyword_method(foo: 'bar')).to eq('bar')
130+
end
131+
124132
end

0 commit comments

Comments
 (0)