spec/pardot/http_spec.rb in ruby-pardot-1.3.1 vs spec/pardot/http_spec.rb in ruby-pardot-1.3.2

- old
+ new

@@ -19,24 +19,25 @@ it "should notice errors and raise them as Pardot::ResponseError" do fake_get "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n) - lambda { get }.should raise_error(Pardot::ResponseError) + + expect(lambda { get }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:get).and_raise(SocketError) + expect(Pardot::Client).to receive(:get).and_raise(SocketError) - lambda { get }.should raise_error(Pardot::NetError) + expect(lambda { get }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_get "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) get end end @@ -48,24 +49,24 @@ it "should notice errors and raise them as Pardot::ResponseError" do fake_post "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n) - lambda { post }.should raise_error(Pardot::ResponseError) + expect(lambda { post }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:post).and_raise(SocketError) + expect(Pardot::Client).to receive(:post).and_raise(SocketError) - lambda { post }.should raise_error(Pardot::NetError) + expect(lambda { post }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_post "/api/foo/version/3/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) post end end @@ -78,24 +79,24 @@ it "should notice errors and raise them as Pardot::ResponseError" do fake_get "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n) - lambda { get }.should raise_error(Pardot::ResponseError) + expect(lambda { get }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:get).and_raise(SocketError) + expect(Pardot::Client).to receive(:get).and_raise(SocketError) - lambda { get }.should raise_error(Pardot::NetError) + expect(lambda { get }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_get "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) get end end @@ -108,23 +109,23 @@ it "should notice errors and raise them as Pardot::ResponseError" do fake_post "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Login failed</err>\n</rsp>\n) - lambda { post }.should raise_error(Pardot::ResponseError) + expect(lambda { post }).to raise_error(Pardot::ResponseError) end it "should catch and reraise SocketErrors as Pardot::NetError" do - Pardot::Client.should_receive(:post).and_raise(SocketError) + expect(Pardot::Client).to receive(:post).and_raise(SocketError) - lambda { post }.should raise_error(Pardot::NetError) + expect(lambda { post }).to raise_error(Pardot::NetError) end it "should call handle_expired_api_key when the api key expires" do fake_post "/api/foo/version/4/bar?format=simple", %(?xml version="1.0" encoding="UTF-8"?>\n<rsp stat="fail" version="1.0">\n <err code="15">Invalid API key or user key</err>\n</rsp>\n) - @client.should_receive(:handle_expired_api_key) + expect(@client).to receive(:handle_expired_api_key) post end end \ No newline at end of file