BigW Consortium Gitlab

commits.rb 3.07 KB
Newer Older
1
class Spinach::Features::ProjectCommits < Spinach::FeatureSteps
Nihad Abbasov committed
2 3 4
  include SharedAuthentication
  include SharedProject
  include SharedPaths
5
  include RepoHelpers
Nihad Abbasov committed
6

7
  step 'I see project commits' do
Dmitriy Zaporozhets committed
8
    commit = @project.repository.commit
9
    page.should have_content(@project.name)
10
    page.should have_content(commit.message[0..20])
11
    page.should have_content(commit.short_id)
12 13
  end

14
  step 'I click atom feed link' do
Douwe Maan committed
15
    click_link "Commits Feed"
16 17
  end

18
  step 'I see commits atom feed' do
19
    commit = @project.repository.commit
20
    response_headers['Content-Type'].should have_content("application/atom+xml")
Douwe Maan committed
21
    body.should have_selector("title", text: "#{@project.name}:master commits")
22 23
    body.should have_selector("author email", text: commit.author_email)
    body.should have_selector("entry summary", text: commit.description[0..10])
24 25
  end

26
  step 'I click on commit link' do
Vinnie Okada committed
27
    visit namespace_project_commit_path(@project.namespace, @project, sample_commit.id)
28 29
  end

30
  step 'I see commit info' do
31 32
    page.should have_content sample_commit.message
    page.should have_content "Showing #{sample_commit.files_changed_count} changed files"
33 34
  end

35
  step 'I fill compare fields with refs' do
36 37
    fill_in "from", with: sample_commit.parent_id
    fill_in "to",   with: sample_commit.id
38 39 40
    click_button "Compare"
  end

41 42 43 44 45 46 47 48 49 50 51 52
  step 'I unfold diff' do
    @diff = first('.js-unfold')
    @diff.click
    sleep 2
  end

  step 'I should see additional file lines' do
    within @diff.parent do
      first('.new_line').text.should_not have_content "..."
    end
  end

53
  step 'I see compared refs' do
54
    page.should have_content "Compare View"
55 56
    page.should have_content "Commits (1)"
    page.should have_content "Showing 2 changed files"
57
  end
58

59
  step 'I see breadcrumb links' do
60 61 62
    page.should have_selector('ul.breadcrumb')
    page.should have_selector('ul.breadcrumb a', count: 4)
  end
randx committed
63

64
  step 'I see commits stats' do
65
    page.should have_content 'Top 50 Committers'
randx committed
66 67
    page.should have_content 'Committers'
    page.should have_content 'Total commits'
Riyad Preukschas committed
68
    page.should have_content 'Authors'
randx committed
69
  end
70

71
  step 'I visit big commit page' do
72
    Commit::DIFF_SAFE_FILES = 20
Vinnie Okada committed
73
    visit namespace_project_commit_path(@project.namespace, @project, sample_big_commit.id)
74 75
  end

76
  step 'I see big commit warning' do
77
    page.should have_content sample_big_commit.message
Dmitriy Zaporozhets committed
78
    page.should have_content "Too many changes"
79
    Commit::DIFF_SAFE_FILES = 100
80
  end
81

82
  step 'I visit a commit with an image that changed' do
Vinnie Okada committed
83
    visit namespace_project_commit_path(@project.namespace, @project, sample_image_commit.id)
84 85
  end

86
  step 'The diff links to both the previous and current image' do
87
    links = all('.two-up span div a')
88 89
    links[0]['href'].should =~ %r{blob/#{sample_image_commit.old_blob_id}}
    links[1]['href'].should =~ %r{blob/#{sample_image_commit.new_blob_id}}
90
  end
91

92
  step 'I click side-by-side diff button' do
Dmitriy Zaporozhets committed
93
    click_link "Side-by-side"
94 95
  end

96
  step 'I see side-by-side diff button' do
Dmitriy Zaporozhets committed
97
    page.should have_content "Side-by-side"
98 99
  end

100
  step 'I see inline diff button' do
Dmitriy Zaporozhets committed
101
    page.should have_content "Inline"
102
  end
103
end