2011-10-08 17:36:38 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe "Commits" do
|
|
|
|
let(:project) { Factory :project }
|
2011-11-27 10:35:49 -05:00
|
|
|
let!(:commit) { project.commit }
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
login_as :user
|
|
|
|
project.add_access(@user, :read)
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "GET /commits" do
|
2011-10-26 09:46:25 -04:00
|
|
|
before do
|
2011-10-08 17:36:38 -04:00
|
|
|
visit project_commits_path(project)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "should have valid path" do
|
|
|
|
current_path.should == project_commits_path(project)
|
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should have project name" do
|
2011-10-08 17:36:38 -04:00
|
|
|
page.should have_content(project.name)
|
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should list commits" do
|
2011-10-08 17:36:38 -04:00
|
|
|
page.should have_content(commit.message)
|
2012-01-29 17:43:14 -05:00
|
|
|
page.should have_content(commit.id.to_s[0..5])
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
2011-11-11 03:11:27 -05:00
|
|
|
|
|
|
|
it "should render atom feed" do
|
|
|
|
visit project_commits_path(project, :atom)
|
|
|
|
|
|
|
|
page.response_headers['Content-Type'].should have_content("application/atom+xml")
|
|
|
|
page.body.should have_selector("title", :text => "Recent commits to #{project.name}")
|
|
|
|
page.body.should have_selector("author email", :text => commit.author_email)
|
|
|
|
page.body.should have_selector("entry summary", :text => commit.message)
|
|
|
|
end
|
2011-11-15 02:25:26 -05:00
|
|
|
|
|
|
|
it "should render atom feed via private token" do
|
|
|
|
logout
|
|
|
|
visit project_commits_path(project, :atom, :private_token => @user.private_token)
|
|
|
|
|
|
|
|
page.response_headers['Content-Type'].should have_content("application/atom+xml")
|
|
|
|
page.body.should have_selector("title", :text => "Recent commits to #{project.name}")
|
|
|
|
page.body.should have_selector("author email", :text => commit.author_email)
|
|
|
|
page.body.should have_selector("entry summary", :text => commit.message)
|
|
|
|
end
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
describe "GET /commits/:id" do
|
|
|
|
before do
|
2011-11-27 10:35:49 -05:00
|
|
|
visit project_commit_path(project, commit.id)
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
|
2011-10-26 09:46:25 -04:00
|
|
|
it "should have valid path" do
|
2011-11-27 10:35:49 -05:00
|
|
|
current_path.should == project_commit_path(project, commit.id)
|
2011-10-08 17:36:38 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|