I am trying to write an rspec test for mixin class. I have the following.
module one
module two
def method
method_details = super
if method_details.a && method_details.b
something
elsif method_details.b
another thing
else
last thing
end
end
end
end
Now I mocked the "method" object, which will be passed to the class. But I'm trying to access the super method. I did,
let(:dummy_class) { Class.new { include one::two } }
How to pass a cheated methodobject to this dummy class?
How can I check this? New to rubies, can someone show me the direction with this.
Thanks in advance.
UPDATE:
I tried,
let(:dummy_class) {
Class.new { |d|
include one::two
d.method = method_details
}
}
let (:method_details){
'different attributes'
}
still not working. I getundefined local variable or method method_details for #<Class:0x007fc9a49cee18>
source
share