Leave a comment

Feature specs – RSpec


Rohit Bhore

Integration test with RSpec and Capybara

Feature spec

Generally we use controller spec, model spec to test our application. What if when you will needs to put everything together? Feature spec is nothing but integration testing.

Feature spec makes sure that models and controllers all workes nicely with other models and controllers in the application.

Capybara

Problem

The old RSpec requests spec used Capybara 1.x as framework for both Integration Test and in capybara.

Solution

Capybara 2.x introduced a few changes with some advanced use. So it’s becomes the term feature instead of request.

If you are upgrading to Capybara 2.0, you’ll need to do a few things:

  • Upgrade rspec-rails to 2.12.0 or greater
  • Move all the tests from spec/request to spec/features

Gemfile

group :test do
  gem "rspec-rails", "~> 2.12.2"
  gem "capybara", "~> 2.0"
end

Capybara lets you know about how a user would interact with your application…

View original post 133 more words

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: