2015-04-26 12:48:37 +05:30
|
|
|
class Spinach::Features::Project < Spinach::FeatureSteps
|
2014-09-02 18:07:02 +05:30
|
|
|
include SharedAuthentication
|
|
|
|
include SharedProject
|
|
|
|
include SharedPaths
|
|
|
|
|
|
|
|
step 'change project settings' do
|
2015-04-26 12:48:37 +05:30
|
|
|
fill_in 'project_name_edit', with: 'NewName'
|
2014-09-02 18:07:02 +05:30
|
|
|
uncheck 'project_issues_enabled'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I save project' do
|
|
|
|
click_button 'Save changes'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project with new settings' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(find_field('project_name').value).to eq 'NewName'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'change project path settings' do
|
2015-04-26 12:48:37 +05:30
|
|
|
fill_in 'project_path', with: 'new-path'
|
|
|
|
click_button 'Rename'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project with new path settings' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(project.path).to eq 'new-path'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
2015-04-26 12:48:37 +05:30
|
|
|
step 'I change the project avatar' do
|
|
|
|
attach_file(
|
|
|
|
:project_avatar,
|
2015-09-11 14:41:01 +05:30
|
|
|
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
|
2015-04-26 12:48:37 +05:30
|
|
|
)
|
|
|
|
click_button 'Save changes'
|
|
|
|
@project.reload
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see new project avatar' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(@project.avatar).to be_instance_of AvatarUploader
|
2015-04-26 12:48:37 +05:30
|
|
|
url = @project.avatar.url
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(url).to eq "/uploads/project/avatar/#{ @project.id }/banana_sample.gif"
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see the "Remove avatar" button' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).to have_link('Remove avatar')
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I have an project avatar' do
|
|
|
|
attach_file(
|
|
|
|
:project_avatar,
|
2015-09-11 14:41:01 +05:30
|
|
|
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
|
2015-04-26 12:48:37 +05:30
|
|
|
)
|
|
|
|
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
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(@project.avatar?).to eq false
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see the "Remove avatar" button' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(page).not_to have_link('Remove avatar')
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project "Shop" version' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within '.project-side' do
|
|
|
|
expect(page).to have_content '6.7.0.pre'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'change project default branch' do
|
|
|
|
select 'fix', from: 'project_default_branch'
|
|
|
|
click_button 'Save changes'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project default branch changed' do
|
2015-09-11 14:41:01 +05:30
|
|
|
expect(find(:css, 'select#project_default_branch').value).to eq 'fix'
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
step 'I select project "Forum" README tab' do
|
|
|
|
click_link 'Readme'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project "Forum" README' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within('#README') do
|
|
|
|
expect(page).to have_content 'Sample repo for testing gitlab features'
|
|
|
|
end
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see project "Shop" README' do
|
2015-09-11 14:41:01 +05:30
|
|
|
page.within('#README') do
|
|
|
|
expect(page).to have_content 'testme'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
step 'I should not see "New Issue" button' do
|
|
|
|
expect(page).not_to have_link 'New Issue'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see "New Merge Request" button' do
|
|
|
|
expect(page).not_to have_link 'New Merge Request'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should not see "Snippets" button' do
|
|
|
|
expect(page).not_to have_link 'Snippets'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'project "Shop" belongs to group' do
|
|
|
|
group = create(:group)
|
|
|
|
@project.namespace = group
|
|
|
|
@project.save!
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see back to dashboard button' do
|
|
|
|
expect(page).to have_content 'Back to Dashboard'
|
|
|
|
end
|
|
|
|
|
|
|
|
step 'I should see back to group button' do
|
|
|
|
expect(page).to have_content 'Back to Group'
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
2014-09-02 18:07:02 +05:30
|
|
|
end
|