Skip to content

Commit

Permalink
Style fixes for ruby-grape#543 / ruby-grape#545 (final pass)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwalex committed Jan 1, 2014
1 parent 2f0e5f7 commit 5952a99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions spec/grape/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1851,10 +1851,10 @@ def self.call(object, env)
subject.routes.map { |route|
route.route_params
}.should eq [{
"group1" => { required: true, type: "Array"},
"group1" => { required: true, type: "Array" },
"group1[param1]" => { required: false, desc: "group1 param1 desc" },
"group1[param2]" => { required: true, desc: "group1 param2 desc" },
"group2" => { required: true, type: "Array"},
"group2" => { required: true, type: "Array" },
"group2[param1]" => { required: false, desc: "group2 param1 desc" },
"group2[param2]" => { required: true, desc: "group2 param2 desc" }
}]
Expand Down
18 changes: 9 additions & 9 deletions spec/grape/validations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def app
last_response.status.should == 400
last_response.body.should == 'children is invalid, children[name] is missing, children[parents] is missing, children[parents] is invalid, children[parents][name] is missing'

get '/within_array', children: { :name => 'foo' }
get '/within_array', children: { name: 'foo' }
last_response.status.should == 400
last_response.body.should == 'children is invalid, children[parents] is missing'

Expand Down Expand Up @@ -327,11 +327,11 @@ def app
last_response.status.should == 400
last_response.body.should == 'planets is invalid, planets[name] is missing'

get '/req', planets: { :name => 'Jupiter' }
get '/req', planets: { name: 'Jupiter' }
last_response.status.should == 400
last_response.body.should == 'planets is invalid'

get '/req', planets: [{ :name => 'Venus' }, { :name => 'Mars' }]
get '/req', planets: [{ name: 'Venus' }, { name: 'Mars' }]
last_response.status.should == 200

put_with_json '/req', planets: []
Expand All @@ -343,11 +343,11 @@ def app
last_response.status.should == 400
last_response.body.should == 'moons is invalid, moons[name] is missing'

get '/opt', name: "Jupiter", moons: { :name => 'Ganymede' }
get '/opt', name: "Jupiter", moons: { name: 'Ganymede' }
last_response.status.should == 400
last_response.body.should == 'moons is invalid'

get '/opt', name: "Jupiter", moons: [{ :name => 'Io' }, { :name => 'Callisto' }]
get '/opt', name: "Jupiter", moons: [{ name: 'Io' }, { name: 'Callisto' }]
last_response.status.should == 200

put_with_json '/opt', name: "Venus"
Expand All @@ -362,11 +362,11 @@ def app
last_response.status.should == 400
last_response.body.should == 'stars is invalid, stars[name] is missing'

get '/grp', stars: { :name => 'Sun' }
get '/grp', stars: { name: 'Sun' }
last_response.status.should == 400
last_response.body.should == 'stars is invalid'

get '/grp', stars: [{ :name => 'Sun' }]
get '/grp', stars: [{ name: 'Sun' }]
last_response.status.should == 200

put_with_json '/grp', stars: []
Expand Down Expand Up @@ -509,11 +509,11 @@ def app
last_response.status.should == 400
last_response.body.should == 'items[required_subitems] is missing'

get '/nested_optional_group', items: [{ key: 'foo', required_subitems: [{ value: 'bar' }]}]
get '/nested_optional_group', items: [{ key: 'foo', required_subitems: [{ value: 'bar' }] }]
last_response.status.should == 200
last_response.body.should == 'nested optional group works'

get '/nested_optional_group', items: [{ key: 'foo', required_subitems: [{ value: 'bar' }], optional_subitems: [{ not_value: 'baz' }]}]
get '/nested_optional_group', items: [{ key: 'foo', required_subitems: [{ value: 'bar' }], optional_subitems: [{ not_value: 'baz' }] }]
last_response.status.should == 400
last_response.body.should == 'items[optional_subitems][value] is missing'
end
Expand Down

0 comments on commit 5952a99

Please sign in to comment.