The difference between RSpec, Capybara and Cucumber

RSpecRSpec is a testing framework. It’s what allows you to write and run your tests.An analogous tool would be MiniTest. In my experience, most commercial Rails projects use RSpec and most open-source Ruby projects use MiniTest. At any Rails job you’re more likely to be using RSpec than MiniTest. (I’m not sure why this is the way it is.)CapybaraSome Rails tests operate at a “low level”, meaning no browser interaction is involved. Other “high level” tests do actually spin up a browser and click links, fill out form fields, etc.Low-level tests can be executed with just RSpec and nothing more. But for tests that use the browser, something more is needed.This is where Capybara comes into the picture. Capybara provides helper methods like fill_in to fill in a form field, click_on to click a button, etc.Please note that Capybara does NOT have to be used in conjunction with Cucumber. It’s completely possible to write integration tests in Rails with just RSpec and Capybara.
The difference between RSpec, Capybara and Cucumber #ruby #rubydeveloper #rubyonrails #rspec, https://rubyonrails.ba/single/the-difference-between-rspec-capybara-and-cucumber

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles