require 'rspec' require 'nokogiri' require "fracture/fracture" require "fracture/matchers/matcher" describe Fracture do context 'path' do let (:body) { <
Index Show Edit New Delete Index Show Edit New Delete BODY } =begin # Examples companies_link company_link edit_company_link new_company_link delete_company_link =end let(:page_parsed) { Nokogiri::HTML.parse(body) } it 'concept 3' do build = [] page_parsed.css('a[href]').map do |item| build << item['href']+(item['data-method'] ? '/delete' :'') end # index p build.grep /\/companies\/\d+\/contacts$/ # show p build.grep /\/companies\/\d+\/contacts\/\d+$/ # edit p build.grep /\/companies\/\d+\/contacts\/\d+\/edit$/ # new p build.grep /\/companies\/\d+\/contacts\/new$/ # delete p build.grep /\/companies\/\d+\/contacts\/\d+\/delete$/ end end context "form" do context "when no form exists" do before { @page = "not a form
" } it("should not have a form") { @page.should_not have_a_form } it("should have a form") { expect { @page.should have_a_form }.to raise_error(RSpec::Expectations::ExpectationNotMetError, /expected to find a form on the page/) } end context "when form exists" do before { @page = "