Connect With Us

Rspec Capybara

By Neha Suwal on Oct, 16, 2016 in rails, testing, rspec, capybara

Rails makes it easier to write your tests. Rspec- rails extends Rails' built-in testing framework to support rspec for requests, controllers, models, views, helpers, mailers and routing.
To install rspec-rails in your rails project, you need to add “ gem rspec-rails ” in your development and test group. Then run bundle install. The “ rails generate rspec:install ” , this command adds spec folder with spec_helper.rb and rails_helper.rb which is used for configurations. For running the specs, “ bundle exec rspec ” is used. By default all _spec.rb files in the spec folder is run.

Rspec testing can be of various types such as controller, model, view, feature, routing, request.

Amongst these all feature testing are high-level tests that walk through your entire application ensuring that each of the components works together. For using feature test we use Capybara, which allow you to write tests that can interact with the web page.

For installing capybara in the project, add ‘gem capybara ’ in your test group. Then run bundle install. Then require capybara/ rails in your spec_helper.rb. To run the test via capybara, selenium-webdriver is required. So you need to add selenium-webdriver in the gem file and run bundle install.

Writing feature test via capybara is a fun element in rails for testing.

Presentation On Rspec Capybara

Share This:

Comments

aaganja
Awesome Like to read similar post on future
 August 24, 2016

Add a new comment

Latest Posts


Design Sprint By Neha Suwal on Aug, 14, 2017

3 years of helping startups and entrepreneurs with technology By Neha Suwal on Aug, 04, 2017

Digital Marketing for Startups By Neha Suwal on Jun, 30, 2017

Jyaasa in Prestige Talks By Neha Suwal on Jun, 16, 2017

Helping digital era entrepreneurs: How Jyaasa helped create a tech startup success story in Sydney. By Kapil Raj Nakhwa on May, 29, 2017