Permalink
Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (22 sloc) 409 Bytes

how to include Capybara RSpec matchers in RSpec

let say you want to use have_content and have_selector in spec

# Gemfile
gem 'capybara'
gem 'rspec'
# spec/spec_helper.rb
#...
require 'capybara/rspec'
#...
require 'spec_helper'

RSpec.describe MyPresenter do
  include Capybara::RSpecMatchers
  
  it do 
    expect("<b>abc</b>").to have_selector("b")
  end
end