27.02.2013 Views

Rails%203%20In%20Action

Rails%203%20In%20Action

Rails%203%20In%20Action

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

82 CHAPTER 3 Developing a real Rails application<br />

Next we covered the basic setup of a Rails application, which started with the rails<br />

new command that initializes an application. Then we segued into setting up the Gemfile<br />

to require certain gems for certain environments, such as RSpec in the test environment,<br />

and then running the installers for these gems so your application is fully<br />

configured to use them. For instance, after running rails g rspec:install, your<br />

application is set up to use RSpec and so will generate RSpec specs rather than the<br />

default Test::Unit tests for your models and controllers.<br />

Finally, you wrote the first story for your application, which involved generating a<br />

controller and a model as well as an introduction to RESTful routing and validations.<br />

With this part of your application covered by Cucumber features, you can be notified<br />

if it is broken by running rake cucumber:ok, a command that runs all the features of<br />

the application and lets you know if everything is working or if anything is broken. If<br />

something is broken, the feature fails, and then it’s up to you to fix it. Without this<br />

automated testing, you would have to do it all manually, and that just isn’t any fun.<br />

Now that you’ve got a first feature under your belt, let’s get into writing the next<br />

one!

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

Saved successfully!

Ooh no, something went wrong!