Skip to content

Commit

Permalink
In Ruby 1.9, the "body" of a Rack response cannot be a String.
Browse files Browse the repository at this point in the history
  • Loading branch information
mdub committed Sep 1, 2010
1 parent 8476d37 commit c93d1b1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/sham_rack/stub_web_service.rb
Expand Up @@ -32,7 +32,7 @@ def register_resource(path, content, content_type = "application/xml", status =
unless request.query_string.to_s.empty?
request_path += "?" + request.query_string
end
[status, {"Content-Type" => content_type}, content] if request_path == path
[status, {"Content-Type" => content_type}, [content]] if request_path == path
end
end

Expand All @@ -43,7 +43,7 @@ def reset
protected

def default_response
[404, {"Content-Type" => "text/plain"}, "Not found"]
[404, {"Content-Type" => "text/plain"}, ["Not found"]]
end

end
Expand Down
4 changes: 2 additions & 2 deletions spec/sham_rack/stub_web_service_spec.rb
Expand Up @@ -43,11 +43,11 @@
before(:each) do

@app.handle do |request|
[200, {}, "response from first handler"] if request.get?
[200, {}, ["response from first handler"]] if request.get?
end

@app.handle do |request|
[200, {}, "response from second handler"] if request.path_info == "/stuff"
[200, {}, ["response from second handler"]] if request.path_info == "/stuff"
end

end
Expand Down
4 changes: 2 additions & 2 deletions spec/sham_rack_spec.rb
Expand Up @@ -107,7 +107,7 @@ def call(env)
[
"201 Created",
{ "Content-Type" => "text/plain", "X-Foo" => "bar" },
"BODY"
["BODY"]
]
end
@response = Net::HTTP.get_response(URI.parse("http://www.test.xyz/"))
Expand Down Expand Up @@ -138,7 +138,7 @@ def call(env)
it "mounts associated block as an app" do

ShamRack.at("simple.xyz") do |env|
["200 OK", { "Content-type" => "text/plain" }, "Easy, huh?"]
["200 OK", { "Content-type" => "text/plain" }, ["Easy, huh?"]]
end

open("http://simple.xyz").read.should == "Easy, huh?"
Expand Down

0 comments on commit c93d1b1

Please sign in to comment.