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

Fix tests for 2.7 behavior change

This commit is contained in:
Thomas Walpole 2019-11-29 09:46:51 -08:00
parent 1410793107
commit 553975782a
2 changed files with 6 additions and 6 deletions

View file

@ -15,7 +15,7 @@ Capybara::SpecHelper.spec '#save_and_open_screenshot' do
@session.save_and_open_screenshot @session.save_and_open_screenshot
expect(@session.driver).to have_received(:save_screenshot) expect(@session.driver).to have_received(:save_screenshot)
.with(expected_file_regex, {}) .with(expected_file_regex, any_args)
expect(Launchy).to have_received(:open).with(expected_file_regex) expect(Launchy).to have_received(:open).with(expected_file_regex)
end end
@ -27,7 +27,7 @@ Capybara::SpecHelper.spec '#save_and_open_screenshot' do
@session.save_and_open_screenshot(custom_path) @session.save_and_open_screenshot(custom_path)
expect(@session.driver).to have_received(:save_screenshot) expect(@session.driver).to have_received(:save_screenshot)
.with(/#{custom_path}$/, {}) .with(/#{custom_path}$/, any_args)
expect(Launchy).to have_received(:open).with(/#{custom_path}$/) expect(Launchy).to have_received(:open).with(/#{custom_path}$/)
end end

View file

@ -19,7 +19,7 @@ Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
@session.save_screenshot @session.save_screenshot
regexp = Regexp.new(File.join(Dir.pwd, 'capybara-\d+\.png')) regexp = Regexp.new(File.join(Dir.pwd, 'capybara-\d+\.png'))
expect(@session.driver).to have_received(:save_screenshot).with(regexp, {}) expect(@session.driver).to have_received(:save_screenshot).with(regexp, any_args)
end end
it 'allows to specify another path' do it 'allows to specify another path' do
@ -28,7 +28,7 @@ Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
custom_path = 'screenshots/1.png' custom_path = 'screenshots/1.png'
@session.save_screenshot(custom_path) @session.save_screenshot(custom_path)
expect(@session.driver).to have_received(:save_screenshot).with(/#{custom_path}$/, {}) expect(@session.driver).to have_received(:save_screenshot).with(/#{custom_path}$/, any_args)
end end
context 'with Capybara.save_path' do context 'with Capybara.save_path' do
@ -39,7 +39,7 @@ Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
@session.save_screenshot @session.save_screenshot
regexp = Regexp.new(File.join(alternative_path, 'capybara-\d+\.png')) regexp = Regexp.new(File.join(alternative_path, 'capybara-\d+\.png'))
expect(@session.driver).to have_received(:save_screenshot).with(regexp, {}) expect(@session.driver).to have_received(:save_screenshot).with(regexp, any_args)
end end
it 'relative paths are relative to save_path' do it 'relative paths are relative to save_path' do
@ -49,7 +49,7 @@ Capybara::SpecHelper.spec '#save_screenshot', requires: [:screenshot] do
custom_path = 'screenshots/2.png' custom_path = 'screenshots/2.png'
@session.save_screenshot(custom_path) @session.save_screenshot(custom_path)
expect(@session.driver).to have_received(:save_screenshot).with(File.expand_path(custom_path, alternative_path), {}) expect(@session.driver).to have_received(:save_screenshot).with(File.expand_path(custom_path, alternative_path), any_args)
end end
end end
end end