mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
08a200b138
Capybara provides a number of helpful matchers for asserting against a DOM structure with various selectors. RSpec's view specs focus on asserting against specific markup; this change ensures this is easier to do. RSpec.describe "todos/show.html.erb", type: :view do it "displays the todo title" do assign :todo, Todo.new(title: "Buy milk") render # without Capybara matchers - potentially ambiguous, doesn't # test markup, only raw text rendered expect(rendered).to contain "Buy milk" # with Capybara matchers expect(rendered).to have_css("header h1", text: "Buy milk") end end |
||
---|---|---|
.. | ||
fixtures | ||
rspec | ||
basic_node_spec.rb | ||
capybara_spec.rb | ||
dsl_spec.rb | ||
rack_test_spec.rb | ||
result_spec.rb | ||
rspec_spec.rb | ||
selenium_spec.rb | ||
selenium_spec_chrome.rb | ||
server_spec.rb | ||
spec_helper.rb |