[rspec-users] How to spec a Rails helper method
dchelimsky at gmail.com
Mon Nov 24 10:48:42 EST 2008
On Fri, Nov 21, 2008 at 12:18 PM, Nick Hoffman <nick at deadorange.com> 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)
> # 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'
> The error that's occuring is:
> NoMethodError in 'PropertiesHelper#format_utilities should format a
> utilities value'
> undefined method `format_utilities' for
> As far as I can tell, my specs match what was recommended back in March 2008
> in this thread:
March is a long time ago :)
Use helper. format_utilities ...
Read this http://rspec.info/documentation/rails/writing/helpers.html
and if you're still unsure feel free to write back.
> Any suggestions?
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users