[rspec-users] How to spec a Rails helper method

Scott Taylor mailing_lists at railsnewbie.com
Sun Nov 23 03:13:49 EST 2008


On Nov 21, 2008, at 1:18 PM, Nick Hoffman wrote:

> I'm trying to write specs for a helper method that I'm creating, but  
> my specs are failing to find the helper method
>
> # app/helpers/properties_helper.rb
> module PropertiesHelper
>  def format_utilities(utilities)
>  end
> end
>
> # spec/helpers/properties_helper_spec.rb
> require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
>
> describe PropertiesHelper do
>  describe '#format_utilities' do
>    it 'should format a utilities value' do
>      format_utilities(nil).should == 'Unknown'
>    end
>  end
> end
>
> The error that's occuring is:


Helpers are no longer automagically mixed into example groups.  Use  
the "helper" object (helper.format_uttilities)

Scott



More information about the rspec-users mailing list