Sha256: 30da57b111b39ec5fa15c5c7dff3dd93b27b5b5d100728ff49b58692a38c58e2
Contents?: true
Size: 1.07 KB
Versions: 8
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true Capybara::SpecHelper.spec "#to_capybara_node" do before do @session.visit('/with_html') end class NodeWrapper def initialize(element); @element = element end def to_capybara_node(); @element end end it "should support have_xxx expectations" do para = NodeWrapper.new(@session.find(:css, '#first')) expect(para).to have_link("ullamco") end it "should support within" do para = NodeWrapper.new(@session.find(:css, '#first')) expect(@session).to have_css('#second') @session.within(para) do expect(@session).to have_link('ullamco') expect(@session).not_to have_css('#second') end end it "should generate correct errors" do para = NodeWrapper.new(@session.find(:css, '#first')) expect do expect(para).to have_text("Header Class Test One") end.to raise_error(/^expected to find text "Header Class Test One" in "Lore/) expect do expect(para).to have_css('#second') end.to raise_error(/^expected to find visible css "#second" within #<Capybara::Node::Element/) end end
Version data entries
8 entries across 8 versions & 1 rubygems