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.

xiv<br />

18<br />

CONTENTS<br />

17.4 Setting up a testing environment 478<br />

Removing Test::Unit 479 ■ Installing RSpec and<br />

Capybara 481<br />

17.5 Writing your first engine feature 482<br />

Your first Capybara test 483 ■ Setting up routes 484 ■ The<br />

topics controller 485 ■ The index action 485 ■ The new<br />

action 488 ■ The create action 489 ■ The show action 490<br />

Showing an association count 492<br />

17.6 Adding more posts to topics 493<br />

17.7 Classes outside your control 497<br />

Engine configuration 497 ■ A fake User model 500<br />

Authenticating topics 501 ■ Adding authorship to topics 505<br />

Post authentication 506 ■ Showing the last post 509<br />

17.8 Releasing as a gem 512<br />

17.9 Integrating with an application 513<br />

17.10 Summary 514<br />

Rack-based applications 516<br />

18.1 Building Rack applications 517<br />

A basic Rack application 518<br />

18.2 Building bigger Rack applications 522<br />

You’re breaking up 522 ■ Running a combined Rack<br />

application 524<br />

18.3 Mounting a Rack application with Rails 525<br />

Mounting Heartbeat 526 ■ Introducing Sinatra 527<br />

The API, by Sinatra 528 ■ Basic error checking 532<br />

18.4 Middleware 533<br />

Middleware in Rails 534 ■ Investigating<br />

ActionDispatch::Static 536 ■ Crafting middleware 538<br />

18.5 Summary 540<br />

appendix A Why Rails? 541<br />

appendix B Tidbits 546<br />

index 551

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

Saved successfully!

Ooh no, something went wrong!