Commit d269d107d86c600ab2add651f47cced8f601ae84

Authored by Sebastian Ziebell
1 parent 3bb342b9

API: fixed adding a note

Now the correct attribute is checked if it's available or not. Also fixed a test.
lib/api/notes.rb
... ... @@ -93,7 +93,7 @@ module Gitlab
93 93 # POST /projects/:id/issues/:noteable_id/notes
94 94 # POST /projects/:id/snippets/:noteable_id/notes
95 95 post ":id/#{noteables_str}/:#{noteable_id_str}/notes" do
96   - required_attributes! [:"#{noteable_id_str}"]
  96 + required_attributes! [:body]
97 97  
98 98 @noteable = user_project.send(:"#{noteables_str}").find(params[:"#{noteable_id_str}"])
99 99 @note = @noteable.notes.new(note: params[:body])
... ...
spec/requests/api/projects_spec.rb
... ... @@ -466,8 +466,7 @@ describe Gitlab::API do
466 466 response.status.should == 200
467 467  
468 468 json_response.should be_an Array
469   - #json_response.first['id'].should == project.repository.commit.id
470   - json_response.size.should == 1
  469 + json_response.first['id'].should == project.repository.commit.id
471 470 end
472 471 end
473 472  
... ...