diff --git a/lib/capybara/spec/session/save_and_open_screenshot_spec.rb b/lib/capybara/spec/session/save_and_open_screenshot_spec.rb index aee9fa401..e64d5534c 100644 --- a/lib/capybara/spec/session/save_and_open_screenshot_spec.rb +++ b/lib/capybara/spec/session/save_and_open_screenshot_spec.rb @@ -7,8 +7,8 @@ it 'opens file from the default directory', :requires => [:screenshot] do expected_file_regex = %r{capybara/capybara-\d+\.png} - @session.driver.stub(:save_screenshot) - Launchy.stub(:open) + allow(@session.driver).to receive(:save_screenshot) + allow(Launchy).to receive(:open) @session.save_and_open_screenshot @@ -19,8 +19,8 @@ it 'opens file from the provided directory', :requires => [:screenshot] do custom_path = 'screenshots/1.png' - @session.driver.stub(:save_screenshot) - Launchy.stub(:open) + allow(@session.driver).to receive(:save_screenshot) + allow(Launchy).to receive(:open) @session.save_and_open_screenshot(custom_path) @@ -32,8 +32,8 @@ context 'when launchy cannot be required' do it 'prints out a correct warning message', :requires => [:screenshot] do file_path = File.join(Dir.tmpdir, 'test.png') - @session.stub(:require).with('launchy').and_raise(LoadError) - @session.stub(:warn) + allow(@session).to receive(:require).with('launchy').and_raise(LoadError) + allow(@session).to receive(:warn) @session.save_and_open_screenshot(file_path)