BigW Consortium Gitlab

commits_spec.rb 1.98 KB
Newer Older
gitlabhq committed
1 2 3 4
require 'spec_helper'

describe "Commits" do
  let(:project) { Factory :project }
5
  let!(:commit) { project.commit }
Nihad Abbasov committed
6
  before do
gitlabhq committed
7 8 9 10 11
    login_as :user
    project.add_access(@user, :read)
  end

  describe "GET /commits" do
Nihad Abbasov committed
12
    before do
gitlabhq committed
13 14 15 16 17 18 19
      visit project_commits_path(project)
    end

    it "should have valid path" do
      current_path.should == project_commits_path(project)
    end

Nihad Abbasov committed
20
    it "should have project name" do
gitlabhq committed
21 22 23
      page.should have_content(project.name)
    end

Nihad Abbasov committed
24
    it "should list commits" do
gitlabhq committed
25
      page.should have_content(commit.message)
26
      page.should have_content(commit.id.to_s[0..5])
gitlabhq committed
27
    end
28 29 30 31 32 33 34 35 36

    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
37 38 39 40 41 42 43 44 45 46

    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
gitlabhq committed
47 48
  end

Nihad Abbasov committed
49 50
  describe "GET /commits/:id" do
    before do
51
      visit project_commit_path(project, commit.id)
gitlabhq committed
52 53
    end

Nihad Abbasov committed
54
    it "should have valid path" do
55
      current_path.should == project_commit_path(project, commit.id)
gitlabhq committed
56 57
    end
  end
58 59 60 61 62 63 64 65 66 67

  describe "GET /commits/compare" do 
    before do
      visit compare_project_commits_path(project)
    end

    it "should have valid path" do
      current_path.should == compare_project_commits_path(project)
    end
  end
gitlabhq committed
68
end