1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

fix warnings in tests

This commit is contained in:
Thomas Walpole 2016-11-21 11:53:59 -08:00
parent 3948f93346
commit 88be820f38
7 changed files with 11 additions and 11 deletions

View file

@ -27,6 +27,7 @@ module Capybara
super(session, base)
@query_scope = query_scope
@query = query
@allow_reload = false
end
def allow_reload!

View file

@ -26,7 +26,7 @@ Capybara::SpecHelper.spec '#accept_alert', requires: [:modals] do
end
it "should accept the alert if the text matches a regexp" do
@session.accept_alert /op.{2}ed/ do
@session.accept_alert(/op.{2}ed/) do
@session.click_link('Open alert')
end
expect(@session).to have_xpath("//a[@id='open-alert' and @opened='true']")

View file

@ -320,7 +320,7 @@ Capybara::SpecHelper.spec '#find' do
end
it "raises an error when there is a single inexact matches" do
expect do
result = @session.find(:xpath, XPath.descendant[XPath.attr(:class).is("almost_singular but")], match: :smart, exact: true)
@session.find(:xpath, XPath.descendant[XPath.attr(:class).is("almost_singular but")], match: :smart, exact: true)
end.to raise_error(Capybara::ElementNotFound)
end
it "raises an error if there is no match" do

View file

@ -425,7 +425,7 @@ Capybara::SpecHelper.spec "node" do
@session.find(:css, 'span')
end.to raise_error(TestApp::TestAppError) do |e|
expect(e.cause).to be_a Capybara::CapybaraError
expect(e.cause.message).to match /Your application server raised an error/
expect(e.cause.message).to match(/Your application server raised an error/)
end
end
@ -436,7 +436,7 @@ Capybara::SpecHelper.spec "node" do
@session.find(:css, 'span')
end.to raise_error(TestApp::TestAppOtherError) do |e|
expect(e.cause).to be_a Capybara::CapybaraError
expect(e.cause.message).to match /Your application server raised an error/
expect(e.cause.message).to match(/Your application server raised an error/)
end
end
end

View file

@ -35,7 +35,7 @@ Capybara::SpecHelper.spec '#text' do
Capybara.ignore_hidden_elements = false
expect(@session.find(:id, "hidden-text").text).to eq('Some of this text is')
end
it "ignores invisible text if ancestor is invisible" do
@session.visit('/with_html')
expect(@session.find(:id, "hidden_via_ancestor", visible: false).text).to eq('')
@ -52,8 +52,7 @@ Capybara::SpecHelper.spec '#text' do
it "should strip whitespace" do
@session.visit('/with_html')
n = @session.find(:css, '#second')
expect(@session.find(:css, '#second').text).to match \
/\ADuis aute .* text with whitespace .* est laborum\.\z/
@session.find(:css, '#second')
expect(@session.find(:css, '#second').text).to match(/\ADuis aute .* text with whitespace .* est laborum\.\z/)
end
end

View file

@ -66,8 +66,8 @@ RSpec.describe Capybara::Result do
it 'supports all modes of []' do
expect(result[1].text).to eq 'Beta'
expect(result[0,2].map &:text).to eq ['Alpha', 'Beta']
expect(result[1..3].map &:text).to eq ['Beta', 'Gamma', 'Delta']
expect(result[0,2].map(&:text)).to eq ['Alpha', 'Beta']
expect(result[1..3].map(&:text)).to eq ['Beta', 'Gamma', 'Delta']
expect(result[-1].text).to eq 'Delta'
end

View file

@ -102,7 +102,7 @@ RSpec.describe Capybara do
table: ".//table"
}
selectors.each do |selector, xpath|
results = string.all(selector,nil).to_a.map &:native
results = string.all(selector,nil).to_a.map(&:native)
expect(results.size).to be > 0
expect(results).to eq string.all(:xpath, xpath).to_a.map(&:native)
end