spec/netprint/agent_spec.rb in netprint-0.3.3 vs spec/netprint/agent_spec.rb in netprint-0.3.4

- old
+ new

@@ -21,20 +21,20 @@ } ). to_return(read_fixture_file('list_empty.html')) end - it 'should login' do - @agent.should_not be_login + it 'logins' do + expect(@agent).not_to be_login @agent.login - @agent.should be_login + expect(@agent).to be_login end shared_examples_for '#upload' do - it 'should upload' do + it 'uploads' do stub_request(:post, 'https://www.printing.ne.jp/usr/web/auth/NPFL0010.seam'). with(body: { 'NPFL0010' => 'NPFL0010', 'display-max-rows' => '10', 'create-document' => '', @@ -60,14 +60,14 @@ filename = File.expand_path(pdf_filename) @agent.login code = @agent.upload(filename) - code.should match(/^[0-9A-Z]{8}$/) + expect(code).to match(/^[0-9A-Z]{8}$/) end - it 'should handle registration error' do + it 'handles registration error' do stub_request(:post, 'https://www.printing.ne.jp/usr/web/auth/NPFL0010.seam'). with(body: { 'NPFL0010' => 'NPFL0010', 'display-max-rows' => '10', 'create-document' => '', @@ -92,16 +92,16 @@ to_return(read_fixture_file('list_error.html')) filename = File.expand_path(pdf_filename) @agent.login - lambda { + expect { @agent.upload(filename) - }.should raise_error(RegistrationError) + }.to raise_error(RegistrationError) end - it 'should handle upload error' do + it 'handles upload error' do stub_request(:post, 'https://www.printing.ne.jp/usr/web/auth/NPFL0010.seam'). with(body: { 'NPFL0010' => 'NPFL0010', 'display-max-rows' => '10', 'create-document' => '', @@ -115,12 +115,12 @@ to_return(read_fixture_file('upload_error.html')) filename = File.expand_path(pdf_filename) @agent.login - lambda { + expect { @agent.upload(filename) - }.should raise_error(UploadError, 'error message') + }.to raise_error(UploadError, 'error message') end end context 'filename is ASCII only' do let(:pdf_filename) { fixture_file('foo.pdf') }