Skip to content

Commit

Permalink
Add spec for content type
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Jul 25, 2011
1 parent f49e16a commit 9da3b84
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/jsonrpc_spec.rb
Expand Up @@ -43,10 +43,19 @@ def self.raw_post_path
@raw_post_path
end

def self.raw_headers=(headers)
@raw_headers = headers
end

def self.raw_headers
@raw_headers
end

def post(path, body, headers = [])
res = Net::HTTPSuccess.new('1.2', '200', 'OK')
self.class.raw_post_path = path
self.class.raw_post_body = body
self.class.raw_headers = headers
res.body = self.class.raw_response_data
res
end
Expand Down Expand Up @@ -76,6 +85,10 @@ def post(path, body, headers = [])
@result.should == {"result" => 200, "message" => "what a great success!"}
end

it 'should set the headers to application/json' do
Net::HTTP.raw_headers.should include("Content-Type" => "application/json")
end

end

describe 'when it is not successful' do
Expand Down

0 comments on commit 9da3b84

Please sign in to comment.