api_client 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
data/lib/api_client/version.rb
CHANGED
@@ -41,7 +41,7 @@ describe ApiClient::Connection::Basic do
|
|
41
41
|
it "can perform GET requests" do
|
42
42
|
@instance.handler.should_receive(:get) do |path, headers|
|
43
43
|
headers.should == @headers
|
44
|
-
Faraday::Utils.parse_nested_query
|
44
|
+
Faraday::Utils.send(:parse_nested_query, path.split("?").last).should == @params
|
45
45
|
@response
|
46
46
|
end
|
47
47
|
@instance.get "/home", @params, @headers
|
@@ -60,7 +60,7 @@ describe ApiClient::Connection::Basic do
|
|
60
60
|
it "can perform DELETE requests" do
|
61
61
|
@instance.handler.should_receive(:delete) do |path, headers|
|
62
62
|
headers.should == @headers
|
63
|
-
Faraday::Utils.parse_nested_query
|
63
|
+
Faraday::Utils.send(:parse_nested_query, path.split("?").last).should == @params
|
64
64
|
@response
|
65
65
|
end
|
66
66
|
@instance.delete "/home", @params, @headers
|
@@ -62,6 +62,13 @@ describe ApiClient::Resource::Base do
|
|
62
62
|
@instance.remote_update
|
63
63
|
end
|
64
64
|
|
65
|
+
it "retains the original scope" do
|
66
|
+
ApiClient::Resource::Base.stub(:update)
|
67
|
+
@instance.original_scope = stub
|
68
|
+
@instance.original_scope.should_receive(:update).with(42, "name" => "Mike")
|
69
|
+
@instance.remote_update
|
70
|
+
end
|
71
|
+
|
65
72
|
end
|
66
73
|
|
67
74
|
describe "#remote_create" do
|
@@ -102,7 +102,7 @@ describe ApiClient::Resource::Scope do
|
|
102
102
|
end
|
103
103
|
|
104
104
|
it "performs a update to update an existing record skipping the namespace if it is not present" do
|
105
|
-
@instance
|
105
|
+
@instance = ApiClient::Resource::Scope.new(Restful2)
|
106
106
|
response = { "id" => 42, "name" => "Foo" }
|
107
107
|
@instance.should_receive(:put).with('/restful2s/42.json', {:name => "Foo"} ).and_return(response)
|
108
108
|
result = @instance.update(42, :name => "Foo")
|