Skip to content

Commit

Permalink
Fix: spec fixes for Ruby 1.8.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Jun 26, 2012
1 parent ad79137 commit db4f5ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/grape/middleware/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def default_options
end

def headers
env.dup.inject({}){|h,(k,v)| h[k.to_s.downcase[5..-1]] = v if k.downcase.to_s.start_with?('http_'); h}
env.dup.inject({}){|h,(k,v)| h[k.to_s.downcase[5..-1]] = v if k.to_s.downcase.start_with?('http_'); h}
end

def before
Expand Down
6 changes: 3 additions & 3 deletions spec/grape/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ def app; subject end
end

it 'should convert JSON bodies to params' do
post '/request_body', MultiJson.encode(user: 'Bobby T.'), {'CONTENT_TYPE' => 'application/json'}
post '/request_body', MultiJson.encode(:user => 'Bobby T.'), {'CONTENT_TYPE' => 'application/json'}
last_response.body.should == 'Bobby T.'
end

it 'should convert JSON bodies to params' do
put '/request_body', MultiJson.encode(user: 'Bobby T.'), {'CONTENT_TYPE' => 'application/json'}
put '/request_body', MultiJson.encode(:user => 'Bobby T.'), {'CONTENT_TYPE' => 'application/json'}
last_response.body.should == 'Bobby T.'
end

Expand All @@ -205,7 +205,7 @@ def app; subject end
subject.post '/omitted_params' do
body_params[:version].should == nil
end
post '/omitted_params', MultiJson.encode(user: 'Blah'), {'CONTENT_TYPE' => 'application/json'}
post '/omitted_params', MultiJson.encode(:user => 'Blah'), {'CONTENT_TYPE' => 'application/json'}
end
end
end
Expand Down

0 comments on commit db4f5ad

Please sign in to comment.