Read about our upcoming Code of Conduct on this issue

project.rb 2.42 KB
Newer Older
1
class Spinach::Features::Project < Spinach::FeatureSteps
Nihad Abbasov's avatar
Nihad Abbasov committed
2
3
4
  include SharedAuthentication
  include SharedProject
  include SharedPaths
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
5

6
  step 'change project settings' do
7
    fill_in 'project_name_edit', with: 'NewName'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
8
9
10
    uncheck 'project_issues_enabled'
  end

11
  step 'I save project' do
12
    click_button 'Save changes'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
13
14
  end

15
  step 'I should see project with new settings' do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
16
17
    find_field('project_name').value.should == 'NewName'
  end
18
19

  step 'change project path settings' do
20
21
    fill_in 'project_path', with: 'new-path'
    click_button 'Rename'
22
23
24
  end

  step 'I should see project with new path settings' do
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    project.path.should == 'new-path'
  end

  step 'I change the project avatar' do
    attach_file(
      :project_avatar,
      File.join(Rails.root, 'public', 'gitlab_logo.png')
    )
    click_button 'Save changes'
    @project.reload
  end

  step 'I should see new project avatar' do
    @project.avatar.should be_instance_of AttachmentUploader
    url = @project.avatar.url
    url.should == "/uploads/project/avatar/#{ @project.id }/gitlab_logo.png"
  end

  step 'I should see the "Remove avatar" button' do
    page.should have_link('Remove avatar')
  end

  step 'I have an project avatar' do
    attach_file(
      :project_avatar,
      File.join(Rails.root, 'public', 'gitlab_logo.png')
    )
    click_button 'Save changes'
    @project.reload
  end

  step 'I remove my project avatar' do
    click_link 'Remove avatar'
    @project.reload
  end

  step 'I should see the default project avatar' do
    @project.avatar?.should be_false
  end

  step 'I should not see the "Remove avatar" button' do
    page.should_not have_link('Remove avatar')
67
  end
68
69
70

  step 'I should see project "Shop" version' do
    within '.project-side' do
71
      page.should have_content "Version: 6.7.0.pre"
72
73
    end
  end
74
75

  step 'change project default branch' do
76
77
    select 'fix', from: 'project_default_branch'
    click_button 'Save changes'
78
79
80
  end

  step 'I should see project default branch changed' do
81
    find(:css, 'select#project_default_branch').value.should == 'fix'
82
  end
83
84
85
86
87
88
89
90
91
92
93
94
95
96

  step 'I select project "Forum" README tab' do
    click_link 'Readme'
  end

  step 'I should see project "Forum" README' do
    page.should have_link "README.md"
    page.should have_content "Sample repo for testing gitlab features"
  end

  step 'I should see project "Shop" README' do
    page.should have_link "README.md"
    page.should have_content "testme"
  end
Nihad Abbasov's avatar
Nihad Abbasov committed
97
end