Hi,
In the relish doc :-
https://www.relishapp.com/rspec/rspec-expectations/v/3-0/docs/built-in-matchers/respond-to-matcher
Note that this matcher relies entirely upon #respond_to?. If an object
dynamically responds to a message via #method_missing, *but does not indicate
this via #respond_to?*, then this matcher will give you false results.
What does the *..* line mean ?
The below test simply passes :-
#!/usr/bin/env ruby
class Foo
def method_missing(name,*args,&block)
self.class.send(:define_method, name) do
"#{name} has been defined dynamically"
end
end
end
rspec :-
require_relative "../test.rb"
describe Foo do
before { subject.foo }
it "defines #foo dynamically" do
expect(subject).to respond_to(:foo)
end
end
I am not able to connect the line I marked with *..* with this example.... :(
--
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore,
if you write the code as cleverly as possible, you are, by definition, not
smart enough to debug it.
--Brian Kernighan