[rspec-users] Rake features vs. cucumber features

Matt Wynne matt at mattwynne.net
Wed Nov 26 09:53:15 EST 2008


I suspect your rails environment isn't being explicitly loaded by any  
code inside the features folder. When you run a rake task, that all  
happens anyway, so Entity will be a known type etc.

Did you generate env.rb using the cucumber generator script? If not  
run one inside an empty rails app and take a look at it.

On 26 Nov 2008, at 14:42, James Byrne wrote:

> What exactly is the difference between these two invocations, beside  
> the
> fact that one is a rake task and one loads and runs the gem  
> directly?  I
> am getting a slew of errors when I run "# cucumber features" whereas  
> "#
> rake features" passes all the tests.
>
> I have manually run "#rake db:test:prepare" but nonetheless I am  
> getting
> an error regarding a "uninitialized constant Entity (NameError)."
>
> The features directory looks like this:
>
> features
> |-- entities
> |   |-- entity.feature
> |   `-- step_definitions
> |       `-- entity_steps.rb
> |-- locations
> |   `-- step_definitions
> |-- sites
> |   `-- step_definitions
> |-- step_definitions
> |   `-- webrat_steps.rb
> `-- support
>    `-- env.rb
>
> Is there something that I must add to the cucumber parameters when
> calling it directly to get this to work as I require? Like, maybe,
> requiring rails or some other library?
>
> Features:
>
> Scenario: Record Entity basic identification information  #
> features/entities/entity.feature:12
>    Given I have a party to some business transaction       #
> features/entities/step_definitions/entity_steps.rb:7
>      uninitialized constant Entity (NameError)
>      ./features/entities/step_definitions/entity_steps.rb:8:in `Given
> /a party to some business transaction/'
>      features/entities/entity.feature:14:in `Given I have a party to
> some business transaction'
>
>
> Steps:
>
> Given /a party to some business transaction/ do
>  @party = Entity.new
> end
> -- 
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



More information about the rspec-users mailing list