Chapter 14
Bootstrapping Rails

Cucumber was born in the Ruby on Rails community, and there are some well-worn patterns for setting up a Rails application to work with Cucumber. This chapter walks you through those steps, from creating a new Rails application right to making your first scenario pass. If you’re about to embark on a Rails project, this chapter was written for you. Even if you don’t work with Rails in your day job, you’ll learn how to work with libraries like FactoryGirl and ActiveRecord that you can put to wider use, even on non-Ruby projects.

Picture the scene.

It’s Monday morning. The coffee is still steaming on your desk, too hot to drink. Your boss bursts into the room.

I’ve got an amazing idea! We’re going to build a blogging platform, a micro-blogging platform. It’s like blogging, right, but your messages are limited to 140 characters. So, you could send them from a phone even! This is going to change the world! We’re going to call it...Squeaker.

You look up, skeptically. He often does this on Mondays—he should get out more, you think to yourself. This does seem like one of his better ideas, though.

Open up your text editor and start to sketch out the first Cucumber feature:

 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
  Then I should see ​"this is my message"

Yeah, that’s it! says your boss. That’s definitely the first thing we should focus on. Can you make it do that?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.122.244