[rspec-users] Uninitialized constant Spec:Story

Mark Thomson mark.thomson at ieee.org
Mon Oct 6 15:12:41 EDT 2008


Good shot - that worked! :-)

Still, I'm curious as to why. Poking around with my very rudimentary 
knowledge of how ruby gems work, it looks as if the files that define 
Spec::Stories are in the rspec gem, not the rspec-rails gem, and as far 
as I can see there is nothing in the skeleton files that get installed 
in <app>/stories to require those files. Does this suggest that the line 
you recommended should be added to the release? But am I the only person 
to have this problem?

Mark.



Ben Mabey wrote:
> Mark Thomson wrote:
>> stories/helper.rb is as follows -
>>
>>
>> ----
>> ENV["RAILS_ENV"] = "test"
>> require File.expand_path(File.dirname(__FILE__) + 
>> "/../config/environment")
>> require 'spec/rails/story_adapter'
>
> Hmm.. Shot in the dark, but try adding
> require 'spec/story'
>
> before the "require 'spec/rails/story_adapter'" line.
>
> -Ben
>>
>> dir = File.dirname(__FILE__)
>> Dir[File.expand_path("#{dir}/steps/*.rb")].uniq.each do |file|
>>  require file
>> end
>>
>> ##
>> # Run a story file relative to the stories directory.
>>
>> def run_local_story(filename, options={})
>>  run File.join(File.dirname(__FILE__), filename), options
>> end
>> ----
>>
>>
>> Mark.
>>
>>
>> Ben Mabey wrote:
>>> Mark Thomson wrote:
>>>> FWIW, I'm running Rails 2.1 on Windows. I have tried running RSpec 
>>>> on two completely separate Rails installations on different 
>>>> machines and get the same result.
>>>>
>>>> Mark.
>>>
>>> Please post your stories/helper.rb.
>>>
>>> -Ben
>>>
>>>>
>>>> Mark Thomson wrote:
>>>>> Indeed I have. Just re-ran it to make sure. No change in behavior.
>>>>>
>>>>> Mark.
>>>>>
>>>>>
>>>>>
>>>>> David Chelimsky wrote:
>>>>>> On Mon, Oct 6, 2008 at 11:29 AM, Mark Thomson 
>>>>>> <mark.thomson at ieee.org> wrote:
>>>>>>  
>>>>>>> Hi, I'm fairly new to Rails and v. new to RSpec. Think it looks 
>>>>>>> pretty
>>>>>>> useful and so I'm trying it out for the first time. I have 
>>>>>>> installed the
>>>>>>> rspec-rails gem and created a simple plain text my_story file and
>>>>>>> my_story.rb file along the lines described here -
>>>>>>> http://www.tomtenthij.co.uk/2008/1/25/rspec-plain-text-story-runner-on-a-fresh-rails-app. 
>>>>>>>
>>>>>>>
>>>>>>> When I run stories/my_story.rb it blows up and the thing that 
>>>>>>> seems most
>>>>>>> significant in the error messages is "uninitialized constant 
>>>>>>> Spec::Story
>>>>>>> (NameError)" which seems to originate from story_adapter.rb:66, 
>>>>>>> where the
>>>>>>> class Spec::Story::Runner::ScenarioRunner is defined.
>>>>>>>
>>>>>>> Would appreciate any guidance towards a resolution of this issue.
>>>>>>>     
>>>>>>
>>>>>> Have you done this:
>>>>>>
>>>>>> script/generate rspec
>>>>>>
>>>>>>  
>>>>>>> Thanks,
>>>>>>>
>>>>>>> Mark
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> rspec-users mailing list
>>>>>>> rspec-users at rubyforge.org
>>>>>>> http://rubyforge.org/mailman/listinfo/rspec-users
>>>>>>>
>>>>>>>     
>>>>>> _______________________________________________
>>>>>> rspec-users mailing list
>>>>>> rspec-users at rubyforge.org
>>>>>> http://rubyforge.org/mailman/listinfo/rspec-users
>>>>>>
>>>>>>
>>>>>>   
>>>>> ------------------------------------------------------------------------ 
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> rspec-users mailing list
>>>>> rspec-users at rubyforge.org
>>>>> http://rubyforge.org/mailman/listinfo/rspec-users
>>>> ------------------------------------------------------------------------ 
>>>>
>>>>
>>>> _______________________________________________
>>>> rspec-users mailing list
>>>> rspec-users at rubyforge.org
>>>> http://rubyforge.org/mailman/listinfo/rspec-users
>>>
>>> _______________________________________________
>>> rspec-users mailing list
>>> rspec-users at rubyforge.org
>>> http://rubyforge.org/mailman/listinfo/rspec-users
>>>
>>>
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081006/67be85d3/attachment.html>


More information about the rspec-users mailing list