2012-09-26 03:40:04 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2013-06-23 17:25:06 +00:00
|
|
|
describe Projects::CommitsController do
|
2014-01-22 19:03:52 +00:00
|
|
|
let(:project) { create(:project) }
|
2013-04-25 14:15:33 +00:00
|
|
|
let(:user) { create(:user) }
|
2012-09-26 03:40:04 +00:00
|
|
|
|
|
|
|
before do
|
|
|
|
sign_in(user)
|
2014-05-26 12:53:34 +00:00
|
|
|
project.team << [user, :master]
|
2012-09-26 03:40:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET show" do
|
2016-10-07 15:49:48 +00:00
|
|
|
context "when the ref name ends in .atom" do
|
|
|
|
render_views
|
|
|
|
|
|
|
|
context "when the ref does not exist with the suffix" do
|
|
|
|
it "renders as atom" do
|
|
|
|
get(:show,
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project.to_param,
|
|
|
|
id: "master.atom")
|
|
|
|
|
|
|
|
expect(response).to be_success
|
|
|
|
expect(response.content_type).to eq('application/atom+xml')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when the ref exists with the suffix" do
|
|
|
|
before do
|
|
|
|
commit = project.repository.commit('master')
|
|
|
|
|
|
|
|
allow_any_instance_of(Repository).to receive(:commit).and_call_original
|
|
|
|
allow_any_instance_of(Repository).to receive(:commit).with('master.atom').and_return(commit)
|
|
|
|
|
|
|
|
get(:show,
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
project_id: project.to_param,
|
|
|
|
id: "master.atom")
|
|
|
|
end
|
|
|
|
|
|
|
|
it "renders as HTML" do
|
|
|
|
expect(response).to be_success
|
|
|
|
expect(response.content_type).to eq('text/html')
|
|
|
|
end
|
2012-09-26 03:40:04 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|