Forum: RSpec Rake features vs. cucumber features

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2008-11-26 15:42
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
Cdf378de2284d8acf137122e541caa28?d=identicon&s=25 Matt Wynne (mattwynne)
on 2008-11-26 15:54
(Received via mailing list)
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.
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 aslak hellesoy (Guest)
on 2008-11-26 15:54
(Received via mailing list)
On Wed, Nov 26, 2008 at 3:42 PM, James Byrne <lists@ruby-forum.com>
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-cucu...

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
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2008-11-26 16:56
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
0be0e4aa42aacd9a8a95c792de273ca7?d=identicon&s=25 aslak hellesoy (Guest)
on 2008-11-26 17:10
(Received via mailing list)
On Wed, Nov 26, 2008 at 4:56 PM, James Byrne <lists@ruby-forum.com>
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 North 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
85d99e7678d8720f6e00ab0f60fe6ea9?d=identicon&s=25 Andrew Premdas (Guest)
on 2008-11-26 23:29
(Received via mailing list)
Maybe

cucumber features -r features

2008/11/26 James Byrne <lists@ruby-forum.com>:
171ea139761951336b844e708d1547ab?d=identicon&s=25 James Byrne (byrnejb)
on 2008-11-27 01:12
Andrew Premdas wrote:
> Maybe
>
> cucumber features -r features
>

YES!!!!
This topic is locked and can not be replied to.