Skip to content

Commit

Permalink
invoking correct chain
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesilveira committed Oct 19, 2010
1 parent 2b4139a commit b277a63
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/restfulie/client/http/verb_request.rb
Expand Up @@ -8,7 +8,7 @@ def initialize(requester)
# * <tt>path: '/posts'</tt>
# * <tt>headers: {'Accept' => '*/*', 'Content-Type' => 'application/atom+xml'}</tt>
def get(params = {})
request(:get, add_querystring(path, params), headers)
request(:get, add_query_string(path, params), headers)
end

# HEAD HTTP verb without {Error}
Expand Down Expand Up @@ -53,7 +53,7 @@ def delete
# * <tt>path: '/posts'</tt>
# * <tt>headers: {'Accept' => '*/*', 'Content-Type' => 'application/atom+xml'}</tt>
def get!(params = {})
request!(:get, add_querystring(path, params), headers)
request!(:get, add_query_string(path, params), headers)
end

# HEAD HTTP verb {Error}
Expand Down Expand Up @@ -96,7 +96,7 @@ def delete!

protected

def add_querystring(path, params)
def add_query_string(path, params)
params = params.map { |param, value| "#{param}=#{value}"}.join("&")
params.blank? ? path : URI.escape("#{path}?#{params}")
end
Expand Down
18 changes: 9 additions & 9 deletions tests/spec/requests/http/adapter_spec.rb
Expand Up @@ -10,39 +10,39 @@
end

it "should get and respond 200 code" do
@client.get("/test").should respond_with_status(200)
@client.at("/test").get.should respond_with_status(200)
end

it "should put and respond 200 code" do
@client.put("/test", "test").should respond_with_status(200)
@client.at("/test").put("test").should respond_with_status(200)
end

it "should delete and respond 200 code" do
@client.delete("/test").should respond_with_status(200)
@client.at("/test").delete.should respond_with_status(200)
end

it "should head and respond 200 code" do
@client.head("/test").should respond_with_status(200)
@client.at("/test").head.should respond_with_status(200)
end

it "should get! and respond 200 code" do
@client.get!("/test").should respond_with_status(200)
@client.at("/test").get!.should respond_with_status(200)
end

it "should post! and respond 201 code" do
@client.post!("/test", "test").should respond_with_status(201)
@client.at("/test", "test").post!.should respond_with_status(201)
end

it "should put! and respond 200 code" do
@client.put!("/test", "test").should respond_with_status(200)
@client.at("/test", "test").put!.should respond_with_status(200)
end

it "should delete! and respond 200 code" do
@client.delete!("/test").should respond_with_status(200)
@client.at("/test").delete!.should respond_with_status(200)
end

it "should head! and respond 200 code" do
@client.head!("/test").should respond_with_status(200)
@client.at("/test").head!.should respond_with_status(200)
end

end
Expand Down

0 comments on commit b277a63

Please sign in to comment.