Skip to content

Commit

Permalink
Add regression spec for passing options to super
Browse files Browse the repository at this point in the history
  • Loading branch information
shioyama committed May 15, 2020
1 parent 7b4ca04 commit b0b5d91
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions spec/mobility/plugins/fallthrough_accessors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ def title=(_value, **_); end
it_behaves_like "locale accessor", :title, :en
it_behaves_like "locale accessor", :title, :de
it_behaves_like "locale accessor", :title, :'pt-BR'

it 'passes arguments and options to super when method does not match' do
mod = Module.new do
def method_missing(method_name, *_args, **options, &block)
(method_name == :foo) ? options : super
end
end

klass = Class.new
klass.include mod
klass.include described_class.new

instance = klass.new

options = { some: 'params' }
expect(instance.foo(**options)).to eq(options)
end
end

describe ".apply" do
Expand Down

0 comments on commit b0b5d91

Please sign in to comment.