debian-mirror-gitlab/features/steps/groups.rb

133 lines
3.5 KiB
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Spinach::Features::Groups < Spinach::FeatureSteps
2014-09-02 18:07:02 +05:30
include SharedAuthentication
include SharedPaths
include SharedGroup
include SharedUser
2015-09-11 14:41:01 +05:30
step 'I should see back to dashboard button' do
2015-11-26 14:37:03 +05:30
expect(page).to have_content 'Go to dashboard'
2015-09-11 14:41:01 +05:30
end
2015-09-25 12:07:36 +05:30
step 'I should see group "Owned"' do
expect(page).to have_content '@owned'
end
step 'I am a signed out user' do
logout
end
step 'Group "Owned" has a public project "Public-project"' do
2015-12-23 02:04:40 +05:30
group = owned_group
2015-09-25 12:07:36 +05:30
@project = create :empty_project, :public,
group: group,
name: "Public-project"
end
step 'I should see project "Public-project"' do
expect(page).to have_content 'Public-project'
end
2015-04-26 12:48:37 +05:30
step 'I should see group "Owned" projects list' do
2015-12-23 02:04:40 +05:30
owned_group.projects.each do |project|
2015-09-11 14:41:01 +05:30
expect(page).to have_link project.name
2014-09-02 18:07:02 +05:30
end
end
2015-04-26 12:48:37 +05:30
step 'I should see projects activity feed' do
2015-09-11 14:41:01 +05:30
expect(page).to have_content 'closed issue'
2014-09-02 18:07:02 +05:30
end
2015-04-26 12:48:37 +05:30
step 'I should see issues from group "Owned" assigned to me' do
2014-09-02 18:07:02 +05:30
assigned_to_me(:issues).each do |issue|
2015-09-11 14:41:01 +05:30
expect(page).to have_content issue.title
2014-09-02 18:07:02 +05:30
end
end
2015-04-26 12:48:37 +05:30
step 'I should see merge requests from group "Owned" assigned to me' do
2014-09-02 18:07:02 +05:30
assigned_to_me(:merge_requests).each do |issue|
2015-09-11 14:41:01 +05:30
expect(page).to have_content issue.title[0..80]
2014-09-02 18:07:02 +05:30
end
end
2015-04-26 12:48:37 +05:30
step 'project from group "Owned" has issues assigned to me' do
2014-09-02 18:07:02 +05:30
create :issue,
project: project,
assignee: current_user,
author: current_user
end
2015-04-26 12:48:37 +05:30
step 'project from group "Owned" has merge requests assigned to me' do
2014-09-02 18:07:02 +05:30
create :merge_request,
source_project: project,
target_project: project,
assignee: current_user,
author: current_user
end
2015-04-26 12:48:37 +05:30
step 'I change group "Owned" name to "new-name"' do
2014-09-02 18:07:02 +05:30
fill_in 'group_name', with: 'new-name'
2015-04-26 12:48:37 +05:30
fill_in 'group_path', with: 'new-name'
2014-09-02 18:07:02 +05:30
click_button "Save group"
end
2015-04-26 12:48:37 +05:30
step 'I should see new group "Owned" name' do
2015-09-11 14:41:01 +05:30
page.within ".navbar-gitlab" do
expect(page).to have_content "new-name"
2014-09-02 18:07:02 +05:30
end
end
step 'I change group "Owned" avatar' do
2015-09-11 14:41:01 +05:30
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
2014-09-02 18:07:02 +05:30
click_button "Save group"
2015-12-23 02:04:40 +05:30
owned_group.reload
2014-09-02 18:07:02 +05:30
end
step 'I should see new group "Owned" avatar' do
2015-12-23 02:04:40 +05:30
expect(owned_group.avatar).to be_instance_of AvatarUploader
expect(owned_group.avatar.url).to eq "/uploads/group/avatar/#{Group.find_by(name:"Owned").id}/banana_sample.gif"
2014-09-02 18:07:02 +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")
2014-09-02 18:07:02 +05:30
end
step 'I have group "Owned" avatar' do
2015-09-11 14:41:01 +05:30
attach_file(:group_avatar, File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif'))
2014-09-02 18:07:02 +05:30
click_button "Save group"
2015-12-23 02:04:40 +05:30
owned_group.reload
2014-09-02 18:07:02 +05:30
end
step 'I remove group "Owned" avatar' do
click_link "Remove avatar"
2015-12-23 02:04:40 +05:30
owned_group.reload
2014-09-02 18:07:02 +05:30
end
step 'I should not see group "Owned" avatar' do
2015-12-23 02:04:40 +05:30
expect(owned_group.avatar?).to eq false
2014-09-02 18:07:02 +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
2015-09-25 12:07:36 +05:30
step 'Group "Owned" has archived project' do
group = Group.find_by(name: 'Owned')
create(:project, namespace: group, archived: true, path: "archived-project")
end
step 'I should see "archived" label' do
expect(page).to have_xpath("//span[@class='label label-warning']", text: 'archived')
end
2015-12-23 02:04:40 +05:30
private
2014-09-02 18:07:02 +05:30
2015-04-26 12:48:37 +05:30
def assigned_to_me(key)
2014-09-02 18:07:02 +05:30
project.send(key).where(assignee_id: current_user.id)
end
def project
2015-12-23 02:04:40 +05:30
owned_group.projects.first
2014-09-02 18:07:02 +05:30
end
end