response.status.should == 200
json_response['body'].should == wall_note.note
end
+
+ it "should return a 404 error if note not found" do
+ get api("/projects/#{project.id}/notes/123", user)
+ response.status.should == 404
+ end
end
describe "POST /projects/:id/notes" do
response.status.should == 201
json_response['body'].should == 'hi!'
end
+
+ it "should return a 400 error if body is missing" do
+ post api("/projects/#{project.id}/notes", user)
+ response.status.should == 400
+ end
end
describe "GET /projects/:id/noteable/:noteable_id/notes" do
json_response.should be_an Array
json_response.first['body'].should == issue_note.note
end
+
+ it "should return a 404 error when issue id not found" do
+ get api("/projects/#{project.id}/issues/123/notes", user)
+ response.status.should == 404
+ end
end
context "when noteable is a Snippet" do
json_response.should be_an Array
json_response.first['body'].should == snippet_note.note
end
+
+ it "should return a 404 error when snippet id not found" do
+ get api("/projects/#{project.id}/snippets/42/notes", user)
+ response.status.should == 404
+ end
end
end
response.status.should == 200
json_response['body'].should == issue_note.note
end
+
+ it "should return a 404 error if issue note not found" do
+ get api("/projects/#{project.id}/issues/#{issue.id}/notes/123", user)
+ response.status.should == 404
+ end
end
context "when noteable is a Snippet" do
response.status.should == 200
json_response['body'].should == snippet_note.note
end
+
+ it "should return a 404 error if snippet note not found" do
+ get api("/projects/#{project.id}/snippets/#{snippet.id}/notes/123", user)
+ response.status.should == 404
+ end
end
end