BigW Consortium Gitlab

groups.rb 1.66 KB
Newer Older
randx committed
1 2 3
class AdminGroups < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedPaths
4
  include SharedUser
randx committed
5
  include SharedActiveTab
6
  include Select2Helper
randx committed
7

8 9 10 11
  When 'I visit admin group page' do
    visit admin_group_path(current_group)
  end

randx committed
12 13 14 15
  When 'I click new group link' do
    click_link "New Group"
  end

16 17 18 19 20
  And 'I have group with projects' do
    @group   = create(:group)
    @project = create(:project, group: @group)
    @event   = create(:closed_issue_event, project: @project)

21
    @project.team << [current_user, :master]
22 23
  end

randx committed
24
  And 'submit form with new group info' do
25 26
    fill_in 'group_name', with: 'gitlab'
    fill_in 'group_description', with: 'Group description'
27
    click_button "Create group"
randx committed
28 29 30 31
  end

  Then 'I should see newly created group' do
    page.should have_content "Group: gitlab"
32
    page.should have_content "Group description"
randx committed
33 34 35 36 37
  end

  Then 'I should be redirected to group page' do
    current_path.should == admin_group_path(Group.last)
  end
38

39 40
  When 'I select user "John Doe" from user list as "Reporter"' do
    user = User.find_by(name: "John Doe")
41
    select2(user.id, from: "#user_ids", multiple: true)
42
    within "#new_team_member" do
43
      select "Reporter", from: "group_access"
44
    end
Dmitriy Zaporozhets committed
45
    click_button "Add users into group"
46 47
  end

48
  Then 'I should see "John Doe" in team list in every project as "Reporter"' do
49
    within ".group-users-list" do
50
      page.should have_content "John Doe"
51 52
      page.should have_content "Reporter"
    end
53 54
  end

55 56 57 58 59 60
  step 'I should be all groups' do
    Group.all.each do |group|
      page.should have_content group.name
    end
  end

61 62 63 64 65
  protected

  def current_group
    @group ||= Group.first
  end
randx committed
66
end