project.rb 3.61 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'
8
    select 'Disabled', from: 'project_project_feature_attributes_issues_access_level'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
9 10
  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
16
    expect(find_field('project_name').value).to eq 'NewName'
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
17
  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
    expect(project.path).to eq 'new-path'
26 27 28 29 30
  end

  step 'I change the project avatar' do
    attach_file(
      :project_avatar,
31
      File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
32 33 34 35 36 37
    )
    click_button 'Save changes'
    @project.reload
  end

  step 'I should see new project avatar' do
38
    expect(@project.avatar).to be_instance_of AvatarUploader
39
    url = @project.avatar.url
Gabriel Mazetto's avatar
Gabriel Mazetto committed
40
    expect(url).to eq "/uploads/project/avatar/#{@project.id}/banana_sample.gif"
41 42 43
  end

  step 'I should see the "Remove avatar" button' do
44
    expect(page).to have_link('Remove avatar')
45 46 47 48 49
  end

  step 'I have an project avatar' do
    attach_file(
      :project_avatar,
50
      File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
51 52 53 54 55 56 57 58 59 60 61
    )
    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
Robert Speicher's avatar
Robert Speicher committed
62
    expect(@project.avatar?).to eq false
63 64 65
  end

  step 'I should not see the "Remove avatar" button' do
66
    expect(page).not_to have_link('Remove avatar')
67
  end
68

69
  step 'change project default branch' do
70 71
    select 'fix', from: 'project_default_branch'
    click_button 'Save changes'
72 73 74
  end

  step 'I should see project default branch changed' do
75
    expect(find(:css, 'select#project_default_branch').value).to eq 'fix'
76
  end
77 78 79 80 81 82

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

  step 'I should see project "Forum" README' do
Douwe Maan's avatar
Douwe Maan committed
83
    page.within('.readme-holder') do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
84 85
      expect(page).to have_content 'Sample repo for testing gitlab features'
    end
86 87 88
  end

  step 'I should see project "Shop" README' do
Douwe Maan's avatar
Douwe Maan committed
89
    page.within('.readme-holder') do
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
90 91
      expect(page).to have_content 'testme'
    end
92
  end
93 94 95 96 97 98 99 100

  step 'I add project tags' do
    fill_in 'Tags', with: 'tag1, tag2'
  end

  step 'I should see project tags' do
    expect(find_field('Tags').value).to eq 'tag1, tag2'
  end
101 102

  step 'I should not see "New Issue" button' do
103
    expect(page).not_to have_link 'New Issue'
104 105 106
  end

  step 'I should not see "New Merge Request" button' do
107
    expect(page).not_to have_link 'New Merge Request'
108
  end
109 110

  step 'I should not see "Snippets" button' do
111 112 113
    page.within '.content' do
      expect(page).not_to have_link 'Snippets'
    end
114
  end
115 116 117 118 119 120 121

  step 'project "Shop" belongs to group' do
    group = create(:group)
    @project.namespace = group
    @project.save!
  end

122
  step 'I click notifications drop down button' do
123
    first('.notifications-btn').click
124 125 126
  end

  step 'I choose Mention setting' do
127
    click_link 'On mention'
128 129 130
  end

  step 'I should see Notification saved message' do
Phil Hughes's avatar
Phil Hughes committed
131 132
    page.within '#notifications-button' do
      expect(page).to have_content 'On mention'
133 134
    end
  end
135 136 137 138 139 140 141 142 143 144

  step 'I create bare repo' do
    click_link 'Create empty bare repository'
  end

  step 'I should see command line instructions' do
    page.within ".empty_wrapper" do
      expect(page).to have_content("Command line instructions")
    end
  end
Nihad Abbasov's avatar
Nihad Abbasov committed
145
end