[rspec-users] helper spec not finding rails core helpers

David Chelimsky dchelimsky at gmail.com
Tue Jul 31 05:50:33 EDT 2007


On 7/30/07, linojon <linojon at gmail.com> wrote:
> Hi,
>
> My helper specs were going ok until I added a call to a rails
> DateHelper method in one of my helpers
> http://api.rubyonrails.com/classes/ActionView/Helpers/
> DateHelper.html#M000574
>
> The helper runs fine from my view templates, just dies in the spec test.
>
> I boiled my question down to a simple (not too useful) example. I'm
> not sure what I'm missing.
>
> # application_helper.rb
> module ApplicationHelper
>
>    def app_foo
>      t = Time.now
>      distance_of_time_in_words( t, t + 50.minutes)
>      return true
>    end
> end
>
> # application_helper_spec.rb
> require File.dirname(__FILE__) + '/../spec_helper'
>
> describe ApplicationHelper do
>    it "should find app_foo in application_helpers.rb" do
>      app_foo.should be_true
>    end
> end
>
> # error output
> NoMethodError in 'ApplicationHelper should find app_foo in
> application_helpers.rb'
> undefined method `distance_of_time_in_words' for [Dynamically
> generated class for RSpec example]:#<Class:0x32d11c8>

Please put bug reports, feature requests, and patches here:

http://rubyforge.org/tracker/index.php?group_id=797

> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list