This is a git diff between Capybara's 'spec/rspec/matchers_spec.rb' and capybara_minitest_spec's 'spec/capybara_rspec_matchers' to demonstrate how I tested the capybara_minitest_spec gem.
-
-
Save ordinaryzelig/4297afa19edd44885248 to your computer and use it in GitHub Desktop.
How I tested the capybara_minitest_spec gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1,58 +1,61 @@ | |
-require 'spec_helper' | |
-require 'capybara/dsl' | |
-require 'capybara/rspec/matchers' | |
+require_relative 'helper' | |
-describe Capybara::RSpecMatchers do | |
+# Setup Rack test app. | |
+require_relative 'test_app/test_app' | |
+Capybara.app = TestApp | |
+ | |
+ | |
+describe CapybaraMiniTestSpec do | |
include Capybara::DSL | |
include Capybara::RSpecMatchers | |
describe "have_css matcher" do | |
it "gives proper description" do | |
- have_css('h1').description.should == "have css \"h1\"" | |
+ have_css('h1').description.must_equal "have css \"h1\"" | |
end | |
context "on a string" do | |
context "with should" do | |
it "passes if has_css? returns true" do | |
- "<h1>Text</h1>".should have_css('h1') | |
+ "<h1>Text</h1>".must_have_css('h1') | |
end | |
it "fails if has_css? returns false" do | |
expect do | |
- "<h1>Text</h1>".should have_css('h2') | |
- end.to raise_error(/expected to find css "h2" but there were no matches/) | |
+ "<h1>Text</h1>".must_have_css('h2') | |
+ end.must_raise_with_message(/expected to find css "h2" but there were no matches/) | |
end | |
it "passes if matched node count equals expected count" do | |
- "<h1>Text</h1>".should have_css('h1', :count => 1) | |
+ "<h1>Text</h1>".must_have_css('h1', :count => 1) | |
end | |
it "fails if matched node count does not equal expected count" do | |
expect do | |
- "<h1>Text</h1>".should have_css('h1', :count => 2) | |
- end.to raise_error(/expected css "h1" to be found 2 times/) | |
+ "<h1>Text</h1>".must_have_css('h1', :count => 2) | |
+ end.must_raise_with_message(/expected css "h1" to be found 2 times/) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_css? returns true" do | |
- "<h1>Text</h1>".should_not have_css('h2') | |
+ "<h1>Text</h1>".wont_have_css('h2') | |
end | |
it "fails if has_no_css? returns false" do | |
expect do | |
- "<h1>Text</h1>".should_not have_css('h1') | |
- end.to raise_error(/expected not to find css "h1"/) | |
+ "<h1>Text</h1>".wont_have_css('h1') | |
+ end.must_raise_with_message(/expected not to find css "h1"/) | |
end | |
it "passes if matched node count does not equal expected count" do | |
- "<h1>Text</h1>".should_not have_css('h1', :count => 2) | |
+ "<h1>Text</h1>".wont_have_css('h1', :count => 2) | |
end | |
it "fails if matched node count equals expected count" do | |
expect do | |
- "<h1>Text</h1>".should_not have_css('h1', :count => 1) | |
- end.to raise_error(/expected not to find css "h1"/) | |
+ "<h1>Text</h1>".wont_have_css('h1', :count => 1) | |
+ end.must_raise_with_message(/expected not to find css "h1"/) | |
end | |
end | |
end | |
@@ -64,25 +67,25 @@ describe Capybara::RSpecMatchers do | |
context "with should" do | |
it "passes if has_css? returns true" do | |
- page.should have_css('h1') | |
+ page.must_have_css('h1') | |
end | |
it "fails if has_css? returns false" do | |
expect do | |
- page.should have_css('h1#doesnotexist') | |
- end.to raise_error(/expected to find css "h1#doesnotexist" but there were no matches/) | |
+ page.must_have_css('h1#doesnotexist') | |
+ end.must_raise_with_message(/expected to find css "h1#doesnotexist" but there were no matches/) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_css? returns true" do | |
- page.should_not have_css('h1#doesnotexist') | |
+ page.wont_have_css('h1#doesnotexist') | |
end | |
it "fails if has_no_css? returns false" do | |
expect do | |
- page.should_not have_css('h1') | |
- end.to raise_error(/expected not to find css "h1"/) | |
+ page.wont_have_css('h1') | |
+ end.must_raise_with_message(/expected not to find css "h1"/) | |
end | |
end | |
end | |
@@ -90,31 +93,31 @@ describe Capybara::RSpecMatchers do | |
describe "have_xpath matcher" do | |
it "gives proper description" do | |
- have_xpath('//h1').description.should == "have xpath \"\/\/h1\"" | |
+ have_xpath('//h1').description.must_equal "have xpath \"\/\/h1\"" | |
end | |
context "on a string" do | |
context "with should" do | |
it "passes if has_xpath? returns true" do | |
- "<h1>Text</h1>".should have_xpath('//h1') | |
+ "<h1>Text</h1>".must_have_xpath('//h1') | |
end | |
it "fails if has_xpath? returns false" do | |
expect do | |
- "<h1>Text</h1>".should have_xpath('//h2') | |
- end.to raise_error(%r(expected to find xpath "//h2" but there were no matches)) | |
+ "<h1>Text</h1>".must_have_xpath('//h2') | |
+ end.must_raise_with_message(%r(expected to find xpath "//h2" but there were no matches)) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_xpath? returns true" do | |
- "<h1>Text</h1>".should_not have_xpath('//h2') | |
+ "<h1>Text</h1>".wont_have_xpath('//h2') | |
end | |
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 not to find xpath "//h1")) | |
+ "<h1>Text</h1>".wont_have_xpath('//h1') | |
+ end.must_raise_with_message(%r(expected not to find xpath "//h1")) | |
end | |
end | |
end | |
@@ -126,25 +129,25 @@ describe Capybara::RSpecMatchers do | |
context "with should" do | |
it "passes if has_xpath? returns true" do | |
- page.should have_xpath('//h1') | |
+ page.must_have_xpath('//h1') | |
end | |
it "fails if has_xpath? returns false" do | |
expect do | |
- page.should have_xpath("//h1[@id='doesnotexist']") | |
- end.to raise_error(%r(expected to find xpath "//h1\[@id='doesnotexist'\]" but there were no matches)) | |
+ page.must_have_xpath("//h1[@id='doesnotexist']") | |
+ end.must_raise_with_message(%r(expected to find xpath "//h1\[@id='doesnotexist'\]" but there were no matches)) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_xpath? returns true" do | |
- page.should_not have_xpath('//h1[@id="doesnotexist"]') | |
+ page.wont_have_xpath('//h1[@id="doesnotexist"]') | |
end | |
it "fails if has_no_xpath? returns false" do | |
expect do | |
- page.should_not have_xpath('//h1') | |
- end.to raise_error(%r(expected not to find xpath "//h1")) | |
+ page.wont_have_xpath('//h1') | |
+ end.must_raise_with_message(%r(expected not to find xpath "//h1")) | |
end | |
end | |
end | |
@@ -153,32 +156,32 @@ describe Capybara::RSpecMatchers do | |
describe "have_selector matcher" do | |
it "gives proper description" do | |
matcher = have_selector('//h1') | |
- "<h1>Text</h1>".should matcher | |
- matcher.description.should == "have xpath \"//h1\"" | |
+ "<h1>Text</h1>".must_have_selector('//h1') | |
+ matcher.description.must_equal "have xpath \"//h1\"" | |
end | |
context "on a string" do | |
context "with should" do | |
it "passes if has_selector? returns true" do | |
- "<h1>Text</h1>".should have_selector('//h1') | |
+ "<h1>Text</h1>".must_have_selector('//h1') | |
end | |
it "fails if has_selector? returns false" do | |
expect do | |
- "<h1>Text</h1>".should have_selector('//h2') | |
- end.to raise_error(%r(expected to find xpath "//h2" but there were no matches)) | |
+ "<h1>Text</h1>".must_have_selector('//h2') | |
+ end.must_raise_with_message(%r(expected to find xpath "//h2" but there were no matches)) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_selector? returns true" do | |
- "<h1>Text</h1>".should_not have_selector(:css, 'h2') | |
+ "<h1>Text</h1>".wont_have_selector(:css, 'h2') | |
end | |
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 not to find css "h1")) | |
+ "<h1>Text</h1>".wont_have_selector(:css, 'h1') | |
+ end.must_raise_with_message(%r(expected not to find css "h1")) | |
end | |
end | |
end | |
@@ -190,31 +193,31 @@ describe Capybara::RSpecMatchers do | |
context "with should" do | |
it "passes if has_selector? returns true" do | |
- page.should have_selector('//h1', :text => 'test') | |
+ page.must_have_selector('//h1', :text => 'test') | |
end | |
it "fails if has_selector? returns false" do | |
expect do | |
- page.should have_selector("//h1[@id='doesnotexist']") | |
- end.to raise_error(%r(expected to find xpath "//h1\[@id='doesnotexist'\]" but there were no matches)) | |
+ page.must_have_selector("//h1[@id='doesnotexist']") | |
+ end.must_raise_with_message(%r(expected to find xpath "//h1\[@id='doesnotexist'\]" but there were no matches)) | |
end | |
it "includes text in error message" do | |
expect do | |
- page.should have_selector("//h1", :text => 'wrong text') | |
- end.to raise_error(%r(expected to find xpath "//h1" with text "wrong text" but there were no matches)) | |
+ page.must_have_selector("//h1", :text => 'wrong text') | |
+ end.must_raise_with_message(%r(expected to find xpath "//h1" with text "wrong text" but there were no matches)) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_css? returns true" do | |
- page.should_not have_selector(:css, 'h1#doesnotexist') | |
+ page.wont_have_selector(:css, 'h1#doesnotexist') | |
end | |
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 not to find css "h1" with text "test")) | |
+ page.wont_have_selector(:css, 'h1', :text => 'test') | |
+ end.must_raise_with_message(%r(expected not to find css "h1" with text "test")) | |
end | |
end | |
end | |
@@ -222,39 +225,39 @@ describe Capybara::RSpecMatchers do | |
describe "have_content matcher" do | |
it "gives proper description" do | |
- have_content('Text').description.should == "have text \"Text\"" | |
+ have_content('Text').description.must_equal "have text \"Text\"" | |
end | |
context "on a string" do | |
context "with should" do | |
it "passes if has_content? returns true" do | |
- "<h1>Text</h1>".should have_content('Text') | |
+ "<h1>Text</h1>".must_have_content('Text') | |
end | |
it "passes if has_content? returns true using regexp" do | |
- "<h1>Text</h1>".should have_content(/ext/) | |
+ "<h1>Text</h1>".must_have_content(/ext/) | |
end | |
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 text "No such Text" in "Text"/) | |
+ "<h1>Text</h1>".must_have_content('No such Text') | |
+ end.must_raise_with_message(/expected there to be text "No such Text" in "Text"/) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_content? returns true" do | |
- "<h1>Text</h1>".should_not have_content('No such Text') | |
+ "<h1>Text</h1>".wont_have_content('No such Text') | |
end | |
it "passes because escapes any characters that would have special meaning in a regexp" do | |
- "<h1>Text</h1>".should_not have_content('.') | |
+ "<h1>Text</h1>".wont_have_content('.') | |
end | |
it "fails if has_no_content? returns false" do | |
expect do | |
- "<h1>Text</h1>".should_not have_content('Text') | |
- end.to raise_error(/expected there not to be text "Text" in "Text"/) | |
+ "<h1>Text</h1>".wont_have_content('Text') | |
+ end.must_raise_with_message(/expected there not to be text "Text" in "Text"/) | |
end | |
end | |
end | |
@@ -266,25 +269,25 @@ describe Capybara::RSpecMatchers do | |
context "with should" do | |
it "passes if has_content? returns true" do | |
- page.should have_content('This is a test') | |
+ page.must_have_content('This is a test') | |
end | |
it "passes if has_content? returns true using regexp" do | |
- page.should have_content(/test/) | |
+ page.must_have_content(/test/) | |
end | |
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 text "No such Text" in "(.*)This is a test(.*)"/) | |
+ page.must_have_content('No such Text') | |
+ end.must_raise_with_message(/expected there to be text "No such Text" in "(.*)This is a test(.*)"/) | |
end | |
context "with default selector CSS" do | |
before { Capybara.default_selector = :css } | |
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 text "No such Text" in "(.*)This is a test(.*)"/) | |
+ page.must_have_content('No such Text') | |
+ end.must_raise_with_message(/expected there to be text "No such Text" in "(.*)This is a test(.*)"/) | |
end | |
after { Capybara.default_selector = :xpath } | |
end | |
@@ -292,13 +295,13 @@ describe Capybara::RSpecMatchers do | |
context "with should_not" do | |
it "passes if has_no_content? returns true" do | |
- page.should_not have_content('No such Text') | |
+ page.wont_have_content('No such Text') | |
end | |
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 there not to be text "This is a test"/) | |
+ page.wont_have_content('This is a test') | |
+ end.must_raise_with_message(/expected there not to be text "This is a test"/) | |
end | |
end | |
end | |
@@ -306,45 +309,45 @@ describe Capybara::RSpecMatchers do | |
describe "have_text matcher" do | |
it "gives proper description" do | |
- have_text('Text').description.should == "have text \"Text\"" | |
+ have_text('Text').description.must_equal "have text \"Text\"" | |
end | |
context "on a string" do | |
context "with should" do | |
it "passes if has_text? returns true" do | |
- "<h1>Text</h1>".should have_text('Text') | |
+ "<h1>Text</h1>".must_have_text('Text') | |
end | |
it "passes if has_text? returns true using regexp" do | |
- "<h1>Text</h1>".should have_text(/ext/) | |
+ "<h1>Text</h1>".must_have_text(/ext/) | |
end | |
it "fails if has_text? returns false" do | |
expect do | |
- "<h1>Text</h1>".should have_text('No such Text') | |
- end.to raise_error(/expected there to be text "No such Text" in "Text"/) | |
+ "<h1>Text</h1>".must_have_text('No such Text') | |
+ end.must_raise_with_message(/expected there to be text "No such Text" in "Text"/) | |
end | |
it "casts has_text? argument to string" do | |
expect do | |
- "<h1>Text</h1>".should have_text(:cast_me) | |
- end.to raise_error(/expected there to be text "cast_me" in "Text"/) | |
+ "<h1>Text</h1>".must_have_text(:cast_me) | |
+ end.must_raise_with_message(/expected there to be text "cast_me" in "Text"/) | |
end | |
end | |
context "with should_not" do | |
it "passes if has_no_text? returns true" do | |
- "<h1>Text</h1>".should_not have_text('No such Text') | |
+ "<h1>Text</h1>".wont_have_text('No such Text') | |
end | |
it "passes because escapes any characters that would have special meaning in a regexp" do | |
- "<h1>Text</h1>".should_not have_text('.') | |
+ "<h1>Text</h1>".wont_have_text('.') | |
end | |
it "fails if has_no_text? returns false" do | |
expect do | |
- "<h1>Text</h1>".should_not have_text('Text') | |
- end.to raise_error(/expected there not to be text "Text" in "Text"/) | |
+ "<h1>Text</h1>".wont_have_text('Text') | |
+ end.must_raise_with_message(/expected there not to be text "Text" in "Text"/) | |
end | |
end | |
end | |
@@ -356,25 +359,25 @@ describe Capybara::RSpecMatchers do | |
context "with should" do | |
it "passes if has_text? returns true" do | |
- page.should have_text('This is a test') | |
+ page.must_have_text('This is a test') | |
end | |
it "passes if has_text? returns true using regexp" do | |
- page.should have_text(/test/) | |
+ page.must_have_text(/test/) | |
end | |
it "fails if has_text? returns false" do | |
expect do | |
- page.should have_text('No such Text') | |
- end.to raise_error(/expected there to be text "No such Text" in "(.*)This is a test(.*)"/) | |
+ page.must_have_text('No such Text') | |
+ end.must_raise_with_message(/expected there to be text "No such Text" in "(.*)This is a test(.*)"/) | |
end | |
context "with default selector CSS" do | |
before { Capybara.default_selector = :css } | |
it "fails if has_text? returns false" do | |
expect do | |
- page.should have_text('No such Text') | |
- end.to raise_error(/expected there to be text "No such Text" in "(.*)This is a test(.*)"/) | |
+ page.must_have_text('No such Text') | |
+ end.must_raise_with_message(/expected there to be text "No such Text" in "(.*)This is a test(.*)"/) | |
end | |
after { Capybara.default_selector = :xpath } | |
end | |
@@ -382,13 +385,13 @@ describe Capybara::RSpecMatchers do | |
context "with should_not" do | |
it "passes if has_no_text? returns true" do | |
- page.should_not have_text('No such Text') | |
+ page.wont_have_text('No such Text') | |
end | |
it "fails if has_no_text? returns false" do | |
expect do | |
- page.should_not have_text('This is a test') | |
- end.to raise_error(/expected there not to be text "This is a test"/) | |
+ page.wont_have_text('This is a test') | |
+ end.must_raise_with_message(/expected there not to be text "This is a test"/) | |
end | |
end | |
end | |
@@ -398,17 +401,17 @@ describe Capybara::RSpecMatchers do | |
let(:html) { '<a href="#">Just a link</a>' } | |
it "gives proper description" do | |
- have_link('Just a link').description.should == "have link \"Just a link\"" | |
+ have_link('Just a link').description.must_equal "have link \"Just a link\"" | |
end | |
it "passes if there is such a button" do | |
- html.should have_link('Just a link') | |
+ html.must_have_link('Just a link') | |
end | |
it "fails if there is no such button" do | |
expect do | |
- html.should have_link('No such Link') | |
- end.to raise_error(/expected to find link "No such Link"/) | |
+ html.must_have_link('No such Link') | |
+ end.must_raise_with_message(/expected to find link "No such Link"/) | |
end | |
end | |
@@ -416,17 +419,17 @@ describe Capybara::RSpecMatchers do | |
let(:html) { '<button>A button</button><input type="submit" value="Another button"/>' } | |
it "gives proper description" do | |
- have_button('A button').description.should == "have button \"A button\"" | |
+ have_button('A button').description.must_equal "have button \"A button\"" | |
end | |
it "passes if there is such a button" do | |
- html.should have_button('A button') | |
+ html.must_have_button('A button') | |
end | |
it "fails if there is no such button" do | |
expect do | |
- html.should have_button('No such Button') | |
- end.to raise_error(/expected to find button "No such Button"/) | |
+ html.must_have_button('No such Button') | |
+ end.must_raise_with_message(/expected to find button "No such Button"/) | |
end | |
end | |
@@ -434,17 +437,17 @@ describe Capybara::RSpecMatchers do | |
let(:html) { '<p><label>Text field<input type="text"/></label></p>' } | |
it "gives proper description" do | |
- have_field('Text field').description.should == "have field \"Text field\"" | |
+ have_field('Text field').description.must_equal "have field \"Text field\"" | |
end | |
it "passes if there is such a field" do | |
- html.should have_field('Text field') | |
+ html.must_have_field('Text field') | |
end | |
it "fails if there is no such field" do | |
expect do | |
- html.should have_field('No such Field') | |
- end.to raise_error(/expected to find field "No such Field"/) | |
+ html.must_have_field('No such Field') | |
+ end.must_raise_with_message(/expected to find field "No such Field"/) | |
end | |
end | |
@@ -455,40 +458,40 @@ describe Capybara::RSpecMatchers do | |
end | |
it "gives proper description" do | |
- have_checked_field('it is checked').description.should == "have field \"it is checked\"" | |
+ have_checked_field('it is checked').description.must_equal "have field \"it is checked\"" | |
end | |
context "with should" do | |
it "passes if there is such a field and it is checked" do | |
- html.should have_checked_field('it is checked') | |
+ html.must_have_checked_field('it is checked') | |
end | |
it "fails if there is such a field but it is not checked" do | |
expect do | |
- html.should have_checked_field('unchecked field') | |
- end.to raise_error(/expected to find field "unchecked field"/) | |
+ html.must_have_checked_field('unchecked field') | |
+ end.must_raise_with_message(/expected to find field "unchecked field"/) | |
end | |
it "fails if there is no such field" do | |
expect do | |
- html.should have_checked_field('no such field') | |
- end.to raise_error(/expected to find field "no such field"/) | |
+ html.must_have_checked_field('no such field') | |
+ end.must_raise_with_message(/expected to find field "no such field"/) | |
end | |
end | |
context "with should not" do | |
it "fails if there is such a field and it is checked" do | |
expect do | |
- html.should_not have_checked_field('it is checked') | |
- end.to raise_error(/expected not to find field "it is checked"/) | |
+ html.wont_have_checked_field('it is checked') | |
+ end.must_raise_with_message(/expected not to find field "it is checked"/) | |
end | |
it "passes if there is such a field but it is not checked" do | |
- html.should_not have_checked_field('unchecked field') | |
+ html.wont_have_checked_field('unchecked field') | |
end | |
it "passes if there is no such field" do | |
- html.should_not have_checked_field('no such field') | |
+ html.wont_have_checked_field('no such field') | |
end | |
end | |
end | |
@@ -500,40 +503,40 @@ describe Capybara::RSpecMatchers do | |
end | |
it "gives proper description" do | |
- have_unchecked_field('unchecked field').description.should == "have field \"unchecked field\"" | |
+ have_unchecked_field('unchecked field').description.must_equal "have field \"unchecked field\"" | |
end | |
context "with should" do | |
it "passes if there is such a field and it is not checked" do | |
- html.should have_unchecked_field('unchecked field') | |
+ html.must_have_unchecked_field('unchecked field') | |
end | |
it "fails if there is such a field but it is checked" do | |
expect do | |
- html.should have_unchecked_field('it is checked') | |
- end.to raise_error(/expected to find field "it is checked"/) | |
+ html.must_have_unchecked_field('it is checked') | |
+ end.must_raise_with_message(/expected to find field "it is checked"/) | |
end | |
it "fails if there is no such field" do | |
expect do | |
- html.should have_unchecked_field('no such field') | |
- end.to raise_error(/expected to find field "no such field"/) | |
+ html.must_have_unchecked_field('no such field') | |
+ end.must_raise_with_message(/expected to find field "no such field"/) | |
end | |
end | |
context "with should not" do | |
it "fails if there is such a field and it is not checked" do | |
expect do | |
- html.should_not have_unchecked_field('unchecked field') | |
- end.to raise_error(/expected not to find field "unchecked field"/) | |
+ html.wont_have_unchecked_field('unchecked field') | |
+ end.must_raise_with_message(/expected not to find field "unchecked field"/) | |
end | |
it "passes if there is such a field but it is checked" do | |
- html.should_not have_unchecked_field('it is checked') | |
+ html.wont_have_unchecked_field('it is checked') | |
end | |
it "passes if there is no such field" do | |
- html.should_not have_unchecked_field('no such field') | |
+ html.wont_have_unchecked_field('no such field') | |
end | |
end | |
end | |
@@ -542,17 +545,17 @@ describe Capybara::RSpecMatchers do | |
let(:html) { '<label>Select Box<select></select></label>' } | |
it "gives proper description" do | |
- have_select('Select Box').description.should == "have select box \"Select Box\"" | |
+ have_select('Select Box').description.must_equal "have select box \"Select Box\"" | |
end | |
it "passes if there is such a select" do | |
- html.should have_select('Select Box') | |
+ html.must_have_select('Select Box') | |
end | |
it "fails if there is no such select" do | |
expect do | |
- html.should have_select('No such Select box') | |
- end.to raise_error(/expected to find select box "No such Select box"/) | |
+ html.must_have_select('No such Select box') | |
+ end.must_raise_with_message(/expected to find select box "No such Select box"/) | |
end | |
end | |
@@ -560,17 +563,18 @@ describe Capybara::RSpecMatchers do | |
let(:html) { '<table><caption>Lovely table</caption></table>' } | |
it "gives proper description" do | |
- have_table('Lovely table').description.should == "have table \"Lovely table\"" | |
+ have_table('Lovely table').description.must_equal "have table \"Lovely table\"" | |
end | |
it "passes if there is such a select" do | |
- html.should have_table('Lovely table') | |
+ html.must_have_table('Lovely table') | |
end | |
it "fails if there is no such select" do | |
expect do | |
- html.should have_table('No such Table') | |
- end.to raise_error(/expected to find table "No such Table"/) | |
+ html.must_have_table('No such Table') | |
+ end.must_raise_with_message(/expected to find table "No such Table"/) | |
end | |
end | |
end | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment