diff --git a/lib/capybara/node/element.rb b/lib/capybara/node/element.rb index b00ee82a..bd2f8bf2 100644 --- a/lib/capybara/node/element.rb +++ b/lib/capybara/node/element.rb @@ -27,6 +27,7 @@ module Capybara super(session, base) @query_scope = query_scope @query = query + @allow_reload = false end def allow_reload! diff --git a/lib/capybara/spec/session/accept_alert_spec.rb b/lib/capybara/spec/session/accept_alert_spec.rb index 5600d92e..d24e99ee 100644 --- a/lib/capybara/spec/session/accept_alert_spec.rb +++ b/lib/capybara/spec/session/accept_alert_spec.rb @@ -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']") diff --git a/lib/capybara/spec/session/find_spec.rb b/lib/capybara/spec/session/find_spec.rb index feadc2ca..157340ca 100644 --- a/lib/capybara/spec/session/find_spec.rb +++ b/lib/capybara/spec/session/find_spec.rb @@ -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 diff --git a/lib/capybara/spec/session/node_spec.rb b/lib/capybara/spec/session/node_spec.rb index f3b4cb15..77049e3e 100644 --- a/lib/capybara/spec/session/node_spec.rb +++ b/lib/capybara/spec/session/node_spec.rb @@ -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 diff --git a/lib/capybara/spec/session/text_spec.rb b/lib/capybara/spec/session/text_spec.rb index 9fca5c63..7de81a9c 100644 --- a/lib/capybara/spec/session/text_spec.rb +++ b/lib/capybara/spec/session/text_spec.rb @@ -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 diff --git a/spec/result_spec.rb b/spec/result_spec.rb index 4c2a167e..33c3dcf6 100644 --- a/spec/result_spec.rb +++ b/spec/result_spec.rb @@ -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 diff --git a/spec/selector_spec.rb b/spec/selector_spec.rb index f7c24670..35a03c55 100644 --- a/spec/selector_spec.rb +++ b/spec/selector_spec.rb @@ -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