Created
April 5, 2012 13:45
-
-
Save AlexParamonov/2311105 to your computer and use it in GitHub Desktop.
Rspec and delegate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "delegate" | |
class A < SimpleDelegator | |
def ex(foo) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require_relative "rspec_and_delegate" | |
describe "stub" do | |
it "should not raise any error" do | |
a = A.new([]) | |
a.stub(:ex) # it did not actually stub ex method on A | |
expect { a.ex }.to_not raise_error # this will raise wrong number of arguments | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
solved this issue by explicitly defining method on an instance by instance_eval.
any ideas how to solve this with rspec?