Rake features vs. cucumber features

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:inGiven I have a party to
some business transaction’

Steps:

Given /a party to some business transaction/ do
@party = Entity.new
end

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 Wed, Nov 26, 2008 at 3:42 PM, James B. [email protected]
wrote:

features
-- 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?

Short answer:
http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/106--verbose-showing-loaded-files

When this is implemented it will be easier to diagnose and fix problems
like
this. It will give you a hint about other --require options you might
want
to add.

Cheers,
Aslak

aslak hellesoy wrote:

When this is implemented it will be easier to diagnose and fix problems
like this. It will give you a hint about other --require options you
might want to add.

Cheers,
Aslak

Thank you. I have add my heartfelt thanks for your work on cucumber. I
tried to wrap my head around rspec/stories when they first appeared late
last summer and I never really did grasp how to use them. Cucumber has
simply transformed the way I now see things in BDD.

I the meantime, could somebody provide me with a hint or two on what I
should pass cucumber with the -r option to get the same effect as rake
features? I have tried, without success, multiple variations on the
essence of the following:

cucumber features -r config/environment lib/cucumber/rails/world

Maybe

cucumber features -r features

2008/11/26 James B. [email protected]:

Andrew P. wrote:

Maybe

cucumber features -r features

YES!!!

On Wed, Nov 26, 2008 at 4:56 PM, James B. [email protected]
wrote:

Thank you. I have add my heartfelt thanks for your work on cucumber. I
tried to wrap my head around rspec/stories when they first appeared late
last summer and I never really did grasp how to use them. Cucumber has
simply transformed the way I now see things in BDD.

Thanks man. I appreciate it. I owe a lot to Dan N. who did JBehave
then
RBehave then RSpec Stories which is where the ideas were born. I only
improved the implementation and added some sugar coating. Seems like
sugar
coating is what’s needed to make things fly hehe.

Plus now there are 51 forks and I have merged in contribs from some 30
people thanks to GitHub. This would never have grown so fast in a
centralised SCM like Subversion.

I the meantime, could somebody provide me with a hint or two on what I
should pass cucumber with the -r option to get the same effect as rake
features? I have tried, without success, multiple variations on the
essence of the following:

cucumber features -r config/environment lib/cucumber/rails/world

Until we have a better way to display --verbose - I’d try to sprinkle
some
puts statements in the cli.rb class to see what gets loaded when you run
via
rake - and try to mimic that from the cucumber command line.

HTH,
Aslak

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs