Skip to content

Commit

Permalink
Use 'expect' format for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
twalpole committed Apr 4, 2014
1 parent 707a2ab commit 59f751f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/capybara/spec/session/save_and_open_screenshot_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)

Expand All @@ -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)

Expand Down

0 comments on commit 59f751f

Please sign in to comment.