O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Associating a Message with a User

We haven’t defined our user association on the Message model yet. Let’s do that now:

 class​ Message < ActiveRecord::Base
  belongs_to ​:user
 end

Cucumber now outputs this:

 Feature: See Messages
 
  Scenario: See another user's messages
  Given there is a User
  And the User has posted the message "this is my message"
  When I visit the page for the User
  Undefined step: "I visit the page for the User" (Cucumber::Undefined)
  features/see_messages.feature:5
  Then I should see "this is my message"
  Undefined step: "I should see "this is my message"" (Cucumber::Undefined)
  features/see_messages.feature:6
 
 1 scenario (1 undefined)
 4 steps (2 undefined, 2 passed)
 

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required