Testing Capybara RSpec View Integration in teamcapybara/capybara
This test suite validates Capybara’s RSpec integration for view testing, focusing on HTML content matching and RSpec matcher functionality. It ensures proper CSS selector matching and verifies the isolation of RSpec matcher proxies.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
teamcapybara/capybara
spec/rspec/views_spec.rb
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'capybara/rspec', type: :view do
it 'allows matchers to be used on strings' do
html = %(<h1>Test header</h1>)
expect(html).to have_css('h1', text: 'Test header')
end
it "doesn't include RSpecMatcherProxies" do
expect(self.class.ancestors).not_to include(Capybara::RSpecMatcherProxies)
end
end