27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Figure 3.4 Welcome aboard: take #2<br />

First steps<br />

your browser, you’ll see the famous Welcome Aboard page from Rails (the same one<br />

you saw when you generated your first application in chapter 1), shown in figure 3.4.<br />

This is the page Capybara sees, and the reason the first step passes is that Capybara<br />

can go to the homepage successfully. This Welcome Aboard page lives at public/<br />

index.html in your application. To proceed, delete this file using this command:<br />

git rm public/index.html<br />

Run rake cucumber:ok again. This time you’ll see that the first step fails:<br />

Given I am on the homepage<br />

No route matches [GET] "/" (ActionController::RoutingError)<br />

The first step fails because you removed the public/index.html file that Rails was originally<br />

serving up at the root path, so the task goes to Rails. Rails claims it can’t handle<br />

that route and throws an exception. You have to tell Rails what to do with a request for<br />

/, or the root route comes in. You can do this easily in config/routes.rb. At the moment,<br />

this file has the content seen in the following listing (comments removed).<br />

Listing 3.9 config/routes.rb<br />

Ticketee::Application.routes.draw do<br />

end<br />

57

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!