Add some tests to compare api

Signed-off-by: NDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
上级 f441436e
......@@ -112,4 +112,24 @@ describe API::API, api: true do
response.status.should == 404
end
end
describe 'GET /GET /projects/:id/repository/compare' do
it "should compare 2 branches" do
get api("/projects/#{project.id}/repository/compare", user), from: 'master', to: 'simple_merge_request'
response.status.should == 200
json_response['commits'].size.should == 3
end
it "should compare 2 commits" do
get api("/projects/#{project.id}/repository/compare", user), from: 'b1e6a9dbf1c85', to: '1e689bfba395'
response.status.should == 200
json_response['commits'].size.should == 0
end
it "should compare 2 commits" do
get api("/projects/#{project.id}/repository/compare", user), from: '1e689bfba395', to: 'b1e6a9dbf1c85'
response.status.should == 200
json_response['commits'].size.should == 4
end
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册