[rspec-users] Cucumber Scaffolds

aslak hellesoy aslak.hellesoy at gmail.com
Wed Nov 12 11:35:40 EST 2008


On Wed, Nov 12, 2008 at 5:17 PM, James B. Byrne <byrnejb at harte-lyne.ca> wrote:
> I have installed all of the various bit and pieces for rspec and cucumber
> and have used:
>
> script/generate feature Frooble name color description
>
> To create a dummy feature and related steps.  Now, while I have been
> poking at Ruby, Rails, RSpec and Stories for a long time, I have never
> really grasped much of what I have been exposed to.  Therefore, I crave
> your indulgence for the next little while as I buckle down to master this
> stuff.  My questions over the next little while will likely be novice
> level.
>
> Taking the frooble skeleton I have reworked it to this:
>
> #manage_entities.feature
>
> Feature: Manage entities
>  In order to keep track of entities
>  A entity maintainer
>  Should be able to manage entities
>  To Protect Revenue
>
>  Scenario: Register a new entity
>    Given I am on the new entity page
>    When I fill in "entity_name" with "My New Entity"
>    And I fill in "entity_legal_name" with "My New Enitity is a CORP"
>    And I fill in "entity_legal_form" with "CORP"
>    And I press "Create"
>    Then I should see "My New Entity"
>    And I should see "My New Enitity is a CORP"
>    And I should see "CORP"
> ...
>
> And
>
> #steps/entity_steps.rb
>
> Given /I am on the new entity page/ do
>  visits "/entities/new"
> end
> ...
>
> When I run # rake features I see this:
>
> Feature: Manage entities  # features/manage_entities.feature
>  In order to keep track of entities
>  A entity maintainer
>  Should be able to manage multiple entities
>  To Protect Revenue
>  Scenario: Register a new entity                                      #
> features/manage_entities.feature:7
>    Given I am on the new entity page                                  #
> features/steps/entity_steps.rb:1
>      undefined method `visits' for
> #<ActionController::Integration::Session:0xb7202094> (NoMethodError)
>
> Now, "visits" is an action predefined in the step file, and one that I
> presume is connected somehow to webrat (installed), which means to me that
> I should not have to define it myself.  Therefore my questions are: Is
> there some manual configuration I am required to do to wire this up
> correctly or am I missing the boat on this altogether?  If there are
> additional set-up steps that I must perform then where to I discover them?
>

Do you have vendor/plugins/webrat ?
If you have webrat as a gem you must require 'webrat' in env.rb

Maybe the generated env.rb should have:
require 'webrat' if !defined?(Webrat)

HTH,
Aslak

> Regards,
>
> --
> ***          E-Mail is NOT a SECURE channel          ***
> James B. Byrne                mailto:ByrneJB at Harte-Lyne.ca
> Harte & Lyne Limited          http://www.harte-lyne.ca
> 9 Brockley Drive              vox: +1 905 561 1241
> Hamilton, Ontario             fax: +1 905 561 0757
> Canada  L8E 3C3
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list