[rspec-users] Learning Cucumber

James Byrne lists at ruby-forum.com
Fri Nov 14 14:04:19 EST 2008

Andrew Premdas wrote:
> What you're doing here is writing imperative features. Writing
> declarative features might be a better alternative. Instead of
> Given I am on the new entity page
>  When I correctly fill in the new entity form
>  Then I should see a confirmation
> Then the feature has much less technical stuff in it that
> 1) Hide the intent
> 2) Make the story brittle to cosmetic changes, in particular to small
> rewordings of error messages and confirmations
> A side effect of this is you need much less regex magic to match your
> expressions.

This advice does help. Thank you.

Is there a way to mix webrat and hard coded steps?  In other words, if I 
have this in my steps file.

Given /I am on the new entity page/ do
  visits "/entities/new"

When /I fill out the form correctly/ do
  fills_in("Common Name", :with => "My Common Name")
  fills_in("Legal Name", :with => "My Legal Name")
  Entity.entity_legal_name = "CORP" # does not work

Is this possible?

How do I set the attribute "entity_legal_form" to "CORP" for that 
entity?  I cannot figure out how to reference that entity instance.
Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list