[rspec-users] webrat the way to go?

Willem van den Ende willem at willemvandenende.com
Sun Sep 28 16:24:01 EDT 2008


I just started playing with cucumber
On Wed, 2008-09-17 at 22:44 +0200, aslak hellesoy wrote:
> If you already know RSpec I think you'd pick it up faster. Cucumber
> has some documentation that might be helpful:
> http://github.com/aslakhellesoy/cucumber/wikis/ruby-on-rails
Definitely helpful - after following the steps here It runs (mostly, see below).

> Hopefully the generators should be helpful for newbies.

They clearly are to me. I created a new feature (for a new model "Invitation) and a rspec_scaffold as indicated on the page.
With the generated Feature it is easy to see the differences with Rspec story runner and the way webrat should work.
It took me a bit to figure out that the generated code assumes the Model has a :name field (my Invitation has a Subject that mostly identifies it).
After fixing that, I get to 10 steps passed, 1 failed (and 6 skipped). Now I am stuck, because I do not understand the failure webrat seems to give-
When I go to invitation/new, I see the Subject field, but WebRat doesn't... :

Feature: Manage invitations
  In order to keep track of invitations
  A invitation mechanic
  Should be able to manage several invitations

  Scenario: Register new invitation
    Given I am on the new invitation page
    When I fill in "Subject" with "My invitation subject"
      Could not find [Webrat::TextField, Webrat::TextareaField, Webrat::PasswordField]: "Subject" (RuntimeError)
      /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/core/flunk.rb:4:in `flunk'
      /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/core/scope.rb:222:in `find_field'
      /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/core/scope.rb:25:in `fills_in'
      /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/rails/session.rb:24:in `send'
      /home/willem/courses/experienceagile/ebay/trunk/excrm/vendor/plugins/webrat/lib/webrat/rails/session.rb:24:in `method_missing'
      /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:448:in `send!'
      /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/integration.rb:448:in `method_missing'
      ./features/steps/common_webrat.rb:13:in `When /^I fill in "(.*)" with "(.*)"$/'
      features/manage_invitations.feature:8:in `When I fill in "Subject" with "My invitation subject"'

I also installed the gems as indicated. "Subject" is a TextField, and I can see it... I would greatly appreciate any help...

Kind regards,


Willem van den Ende
Living Software B.V.
www.livingsoftware.nl | www.experienceagile.eu | blog: me.andering.com
+31 6 413 06 965 | Spilmanstraat 25 | 5645 JE Eindhoven

More information about the rspec-users mailing list