Skip to content

Commit

Permalink
fix wrong spec descriptions for rspec matcher specs
Browse files Browse the repository at this point in the history
  • Loading branch information
nashby committed Jul 8, 2012
1 parent c4db33a commit d2e9d7a
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions spec/rspec/matchers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,23 @@

context "on a string" do
context "with should" do
it "passes if has_css? returns true" do
it "passes if has_xpath? returns true" do
"<h1>Text</h1>".should have_xpath('//h1')
end

it "fails if has_css? returns false" do
it "fails if has_xpath? returns false" do
expect do
"<h1>Text</h1>".should have_xpath('//h2')
end.to raise_error(%r(expected xpath "//h2" to return something))
end
end

context "with should_not" do
it "passes if has_no_css? returns true" do
it "passes if has_no_xpath? returns true" do
"<h1>Text</h1>".should_not have_xpath('//h2')
end

it "fails if has_no_css? returns false" do
it "fails if has_no_xpath? returns false" do
expect do
"<h1>Text</h1>".should_not have_xpath('//h1')
end.to raise_error(%r(expected xpath "//h1" not to return anything))
Expand All @@ -125,23 +125,23 @@
end

context "with should" do
it "passes if has_css? returns true" do
it "passes if has_xpath? returns true" do
page.should have_xpath('//h1')
end

it "fails if has_css? returns false" do
it "fails if has_xpath? returns false" do
expect do
page.should have_xpath("//h1[@id='doesnotexist']")
end.to raise_error(%r(expected xpath "//h1\[@id='doesnotexist'\]" to return something))
end
end

context "with should_not" do
it "passes if has_no_css? returns true" do
it "passes if has_no_xpath? returns true" do
page.should_not have_xpath('//h1[@id="doesnotexist"]')
end

it "fails if has_no_css? returns false" do
it "fails if has_no_xpath? returns false" do
expect do
page.should_not have_xpath('//h1')
end.to raise_error(%r(expected xpath "//h1" not to return anything))
Expand All @@ -159,11 +159,11 @@

context "on a string" do
context "with should" do
it "passes if has_css? returns true" do
it "passes if has_selector? returns true" do
"<h1>Text</h1>".should have_selector('//h1')
end

it "fails if has_css? returns false" do
it "fails if has_selector? returns false" do
expect do
"<h1>Text</h1>".should have_selector('//h2')
end.to raise_error(%r(expected xpath "//h2" to return something))
Expand All @@ -181,11 +181,11 @@
end

context "with should_not" do
it "passes if has_no_css? returns true" do
it "passes if has_no_selector? returns true" do
"<h1>Text</h1>".should_not have_selector(:css, 'h2')
end

it "fails if has_no_css? returns false" do
it "fails if has_no_selector? returns false" do
expect do
"<h1>Text</h1>".should_not have_selector(:css, 'h1')
end.to raise_error(%r(expected css "h1" not to return anything))
Expand All @@ -199,11 +199,11 @@
end

context "with should" do
it "passes if has_css? returns true" do
it "passes if has_selector? returns true" do
page.should have_selector('//h1', :text => 'test')
end

it "fails if has_css? returns false" do
it "fails if has_selector? returns false" do
expect do
page.should have_selector("//h1[@id='doesnotexist']")
end.to raise_error(%r(expected xpath "//h1\[@id='doesnotexist'\]" to return something))
Expand Down Expand Up @@ -231,7 +231,7 @@
page.should_not have_selector(:css, 'h1#doesnotexist')
end

it "fails if has_no_css? returns false" do
it "fails if has_no_selector? returns false" do
expect do
page.should_not have_selector(:css, 'h1', :text => 'test')
end.to raise_error(%r(expected css "h1" with text "test" not to return anything))
Expand All @@ -247,23 +247,23 @@

context "on a string" do
context "with should" do
it "passes if has_css? returns true" do
it "passes if has_content? returns true" do
"<h1>Text</h1>".should have_content('Text')
end

it "fails if has_css? returns false" do
it "fails if has_content? returns false" do
expect do
"<h1>Text</h1>".should have_content('No such Text')
end.to raise_error(/expected there to be content "No such Text" in "Text"/)
end
end

context "with should_not" do
it "passes if has_no_css? returns true" do
it "passes if has_no_content? returns true" do
"<h1>Text</h1>".should_not have_content('No such Text')
end

it "fails if has_no_css? returns false" do
it "fails if has_no_content? returns false" do
expect do
"<h1>Text</h1>".should_not have_content('Text')
end.to raise_error(/expected content "Text" not to return anything/)
Expand All @@ -277,19 +277,19 @@
end

context "with should" do
it "passes if has_css? returns true" do
it "passes if has_content? returns true" do
page.should have_content('This is a test')
end

it "fails if has_css? returns false" do
it "fails if has_content? returns false" do
expect do
page.should have_content('No such Text')
end.to raise_error(/expected there to be content "No such Text" in "(.*)This is a test(.*)"/)
end

context "with default selector CSS" do
before { Capybara.default_selector = :css }
it "fails if has_css? returns false" do
it "fails if has_content? returns false" do
expect do
page.should have_content('No such Text')
end.to raise_error(/expected there to be content "No such Text" in "(.*)This is a test(.*)"/)
Expand All @@ -299,11 +299,11 @@
end

context "with should_not" do
it "passes if has_no_css? returns true" do
it "passes if has_no_content? returns true" do
page.should_not have_content('No such Text')
end

it "fails if has_no_css? returns false" do
it "fails if has_no_content? returns false" do
expect do
page.should_not have_content('This is a test')
end.to raise_error(/expected content "This is a test" not to return anything/)
Expand Down

0 comments on commit d2e9d7a

Please sign in to comment.