Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find Rspec + Capybara 'Getting Started' guides?

I've been meaning to get into testing. After reading about a few testing frameworks (test::unit, Rspec, etc). I've decided give Rspec and Capybara a try.

I'd like to understand how experienced developers utilize these libraries properly. Which in-turn will help me write better application code and find bugs or little errors in the smallest cracks in the application.

Approaching this as a total TDD nooby. What online sources have you come across to help you learn about Rspec + Capybara. I found this Railscast, which is a good starting point. Are there any other sources / articles I should be reading?

I came across The Rspec Book, which is great for Rspec, but touches more on Cucumber examples.

In addition, how can I find out all the functions available for Capybara. i.e. fill_in, click_link, etc. The Github page mentions a few, but not all.

like image 538
Christian Fazzini Avatar asked Jun 17 '11 20:06

Christian Fazzini


People also ask

What is RSpec and capybara?

Capybara is a framework which allows us to test the code in our views by filling in form data, inspecting page content and sending HTTP requests to the browser. Let's set up a spec to test our newly created form: rails generate rspec:feature form. This will generate the file spec/features/form_spec.rb .

What is Capybara testing?

Capybara is a web-based test automation software that simulates scenarios for user stories and automates web application testing for behavior-driven software development. It is written in the Ruby programming language.

What is Ruby RSpec?

RSpec is a testing tool for Ruby, created for behavior-driven development (BDD). It is the most frequently used testing library for Ruby in production applications. Even though it has a very rich and powerful DSL (domain-specific language), at its core it is a simple tool which you can start using rather quickly.


1 Answers

I also use Rspec with Capybara, and i get along very well with this references:

  • Action methods: http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Actions
  • Find methods: http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Finders
  • Match methods: http://rubydoc.info/github/jnicklas/capybara/master/Capybara/Node/Matchers

Hope it helps!

like image 124
grzuy Avatar answered Nov 16 '22 00:11

grzuy