spec/gnawrnip/screenshot_spec.rb in gnawrnip-0.2.5 vs spec/gnawrnip/screenshot_spec.rb in gnawrnip-0.3.0
- old
+ new
@@ -4,11 +4,11 @@
module Gnawrnip
describe Screenshot do
context 'Not support save_screenshot' do
describe '.tale' do
before do
- GnawrnipTest::Session.any_instance.stub(:save_screenshot) do
+ allow_any_instance_of(GnawrnipTest::Session).to receive(:save_screenshot) do
raise Capybara::NotSupportedByDriverError
end
end
it 'should raise Capybara::NotSupportByDriverError' do
@@ -18,19 +18,19 @@
end
context 'raise unknown error' do
describe '.take' do
before do
- GnawrnipTest::Session.any_instance.stub(:save_screenshot) do
+ allow_any_instance_of(GnawrnipTest::Session).to receive(:save_screenshot) do
raise Timeout::Error
end
end
context 'timeout' do
before do
now = Time.now
- Time.stub(:now).and_return(now, now + 3)
+ allow(Time).to receive(:now).and_return(now, now + 3)
end
it 'should raise Timeout Error' do
screenshot = Capybara.using_wait_time 2 do
Screenshot.take
@@ -43,10 +43,10 @@
end
context 'success screenshot' do
describe '.take' do
before do
- Screenshot.should_receive(:shot).once
+ expect(Screenshot).to receive(:shot).once
end
it { Screenshot.take }
end
end