Reputation: 4615
I have the following:
setup do
Capybara.current_driver = Capybara.javascript_driver
@project.user = @user
@project.save
Project.any_instance.stubs(:price_all)
end
And yet I have a test failing because the Project.price_all method is being run:
/Users/me/code/rails/myapp/app/models/project.rb:178:in `price_all'
This was working properly until I upgraded to Capybara 2 and the latest version of capybara-webkit.
Why is that method still being run? And how can I fix?
Upvotes: 0
Views: 237
Reputation: 3181
When you say "the Project.price_all
method is being run", is that a typo, or is price_all
really a class method? If it is indeed a class method, you'll want to use Project.stubs(:price_all)
instead of including any_instance
so the stub is directly on the Project
class rather than an instance of Project
. If that's not your issue, I'm not sure what else to suggest based on the code sample you've provided.
Upvotes: 0