spec/rapidash/client_spec.rb in rapidash-0.3.1 vs spec/rapidash/client_spec.rb in rapidash-0.4.0

- old
+ new

@@ -29,20 +29,20 @@ let(:test_client) { TestClientTester.new({}) } describe "#method" do it "should include the HTTPClient" do client = HTTPClientTester.new - client.class.ancestors.should include(Rapidash::HTTPClient) + expect(client.class.ancestors).to include(Rapidash::HTTPClient) end it "should include the OAuthClient" do client = OAuthClientTester.new({:uid => "foo", :secret => "bar", :site => "baz"}) - client.class.ancestors.should include(Rapidash::OAuthClient) + expect(client.class.ancestors).to include(Rapidash::OAuthClient) end it "should include the OAuthClient" do - test_client.class.ancestors.should include(Rapidash::TestClient) + expect(test_client.class.ancestors).to include(Rapidash::TestClient) end it "should raise an error on anything else" do expect { class InvalidClientTester < Rapidash::Client @@ -52,23 +52,23 @@ end end describe "#use_patch" do it "should set the patch variable to true" do - HTTPClientPatchTester.new.class.instance_variable_get(:@patch).should eql(true) + expect(HTTPClientPatchTester.new.class.instance_variable_get(:@patch)).to eql(true) end end describe "#extension" do it "should set the url_extension variable" do - HTTPClientExtensionTester.new.class.instance_variable_get(:@extension).should eql(:js) + expect(HTTPClientExtensionTester.new.class.instance_variable_get(:@extension)).to eql(:js) end end describe "#raise_errors" do it "should set the raise_error variable" do - HTTPClientErrorTester.new.class.instance_variable_get(:@raise_error).should eql(true) + expect(HTTPClientErrorTester.new.class.instance_variable_get(:@raise_error)).to eql(true) end end it "should raise an error when instantiated" do @@ -77,22 +77,22 @@ }.to raise_error(Rapidash::ConfigurationError) end describe ".site=" do it "should clear the connection variable after set new site" do - test_client.instance_variable_get(:@connection).should eql(nil) + expect(test_client.instance_variable_get(:@connection)).to eql(nil) test_client.site = "foo" test_client.instance_variable_set(:@connection, "Not nil") test_client.site = "bar" - test_client.instance_variable_get(:@connection).should eql(nil) + expect(test_client.instance_variable_get(:@connection)).to eql(nil) end it "should set the site variable" do - test_client.instance_variable_get(:@site).should eql(nil) + expect(test_client.instance_variable_get(:@site)).to eql(nil) test_client.site = "foo" - test_client.instance_variable_get(:@site).should eql("foo") + expect(test_client.instance_variable_get(:@site)).to eql("foo") end end describe ".encode_request_with" do let(:klass) { test_client.class } @@ -109,53 +109,53 @@ end end describe ".get" do it "should call request" do - test_client.should_receive(:request).with(:get, "foo", {}) + allow(test_client).to receive(:request).with(:get, "foo", {}) test_client.get("foo") end end describe ".post" do it "should call request" do - test_client.should_receive(:request).with(:post, "foo", {}) + allow(test_client).to receive(:request).with(:post, "foo", {}) test_client.post("foo") end end describe ".put" do it "should call request" do - test_client.should_receive(:request).with(:put, "foo", {}) + allow(test_client).to receive(:request).with(:put, "foo", {}) test_client.put("foo") end end describe ".patch" do it "should call request" do - test_client.should_receive(:request).with(:patch, "foo", {}) + allow(test_client).to receive(:request).with(:patch, "foo", {}) test_client.patch("foo") end end describe ".delete" do it "should call request" do - test_client.should_receive(:request).with(:delete, "foo", {}) + allow(test_client).to receive(:request).with(:delete, "foo", {}) test_client.delete("foo") end end describe ".normalize_url" do it "should use the instance extension if set" do test_client.extension = :json - test_client.normalize_url("users").should eql("users.json") + expect(test_client.normalize_url("users")).to eql("users.json") end it "should use the class extension if set" do - HTTPClientExtensionTester.new.normalize_url("users").should eql("users.js") + expect(HTTPClientExtensionTester.new.normalize_url("users")).to eql("users.js") end it "should return the url if no extension if set" do - test_client.normalize_url("users").should eql("users") + expect(test_client.normalize_url("users")).to eql("users") end end end