4

What I'm trying to ahieve is to do integration tests with webrat in rails3 like Yehuda does with test-unit in http://pivotallabs.com/talks/76-extending-rails-3 minute 34.

an example:

describe SomeApp
  it "should show the index page"
    visit "/"
    body.should =~ /hello world/
  end
end

Does someone knows a way to do it?

John Bachir
  • 22,495
  • 29
  • 154
  • 227
makevoid
  • 3,276
  • 2
  • 33
  • 29

4 Answers4

5

Have you tried using rspec-rails: http://github.com/rspec/rspec-rails

That is the repository (install instructions in the Readme) for the new RSpec 2.0 which will work with Rails 3.

Bill Turner
  • 3,695
  • 1
  • 20
  • 26
3

thoughtbot just published a blog post on this.

Stability can become an issue as web applications evolve and grow — integration tests provide a great way to perform end-to-end tests that validate the application is performing as expected.

RSpec integration tests with Capybara for end-to-end testing

Caleb Hearth
  • 3,315
  • 5
  • 30
  • 44
2

Support for Rails 3 is coming in rSpec 2, apparently.

Toby Hede
  • 36,755
  • 28
  • 133
  • 162
1

ceck this link now it is very simple tu use rspec with rails3 http://github.com/rspec/rspec-rails and you don't need to run script/generate rspec_scaffold like in rails 2.x.x, now you just run rails g scaffold and it will generate the rspec files

Boris Barroso
  • 1,802
  • 2
  • 22
  • 41