[rspec-users] Problem with mocking helper methods
dchelimsky at gmail.com
Mon Nov 14 23:13:18 EST 2011
On Nov 11, 2011, at 6:48 AM, Ervin wrote:
> Given that I assume that rails helper image_tag works as intended, I
> want to mock out call to this method in my helper.
> require 'spec_helper'
> describe SomeHelper do
> it 'allows stub tags' do
> helper.image_tag(2).should == 3
Unfortunately, I copied the example (from 'it' to 'end') directly into a helper spec and it passed :(
Are there any other testing related gems in your Gemfile that might be gumming things up?
> Failure/Error : helper.image_tag(2).should == 3
> expected : 3
> got : "<img alt=\"2\" src=\"/assets/2\" />" (using ==)
> * rspec (2.7.0)
> * rspec-core (2.7.1)
> * rspec-expectations (2.7.0)
> * rspec-mocks (2.7.0)
> * rspec-rails (2.7.0)
> * rails (3.1.1)
More information about the rspec-users