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/.
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
On Wed, Nov 26, 2008 at 3:42 PM, James Byrne <lists at ruby-forum.com> 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? >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> > 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 >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081126/3a4be120/attachment.html>
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, > AslakThank 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 -- Posted via http://www.ruby-forum.com/.
On Wed, Nov 26, 2008 at 4:56 PM, James Byrne <lists at ruby-forum.com> wrote:> 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. >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/worldUntil 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> > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > 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/20081126/845f17d7/attachment-0001.html>
Maybe cucumber features -r features 2008/11/26 James Byrne <lists at ruby-forum.com>:> 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 > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >