BigW Consortium Gitlab

group.rb 2.05 KB
Newer Older
1
class Spinach::Features::DashboardGroup < Spinach::FeatureSteps
2 3 4 5 6 7 8 9
  include SharedAuthentication
  include SharedGroup
  include SharedPaths
  include SharedUser

  # Leave

  step 'I click on the "Leave" button for group "Owned"' do
10
    find(:css, 'li', text: "Owner").find(:css, 'i.fa.fa-sign-out').click
11 12 13 14
    # poltergeist always confirms popups.
  end

  step 'I click on the "Leave" button for group "Guest"' do
15
    find(:css, 'li', text: "Guest").find(:css, 'i.fa.fa-sign-out').click
16 17 18 19
    # poltergeist always confirms popups.
  end

  step 'I should not see the "Leave" button for group "Owned"' do
20
    expect(find(:css, 'li', text: "Owner")).not_to have_selector(:css, 'i.fa.fa-sign-out')
21 22 23 24
    # poltergeist always confirms popups.
  end

  step 'I should not see the "Leave" button for groupr "Guest"' do
25
    expect(find(:css, 'li', text: "Guest")).not_to have_selector(:css,  'i.fa.fa-sign-out')
26 27 28 29
    # poltergeist always confirms popups.
  end

  step 'I should see group "Owned" in group list' do
30
    expect(page).to have_content("Owned")
31 32 33
  end

  step 'I should not see group "Owned" in group list' do
34
    expect(page).not_to have_content("Owned")
35 36 37
  end

  step 'I should see group "Guest" in group list' do
38
    expect(page).to have_content("Guest")
39 40 41
  end

  step 'I should not see group "Guest" in group list' do
42
    expect(page).not_to have_content("Guest")
43
  end
44 45 46 47 48 49 50 51 52 53 54 55

  step 'I click new group link' do
    click_link "New Group"
  end

  step 'submit form with new group "Samurai" info' do
    fill_in 'group_path', with: 'Samurai'
    fill_in 'group_description', with: 'Tokugawa Shogunate'
    click_button "Create group"
  end

  step 'I should be redirected to group "Samurai" page' do
56
    expect(current_path).to eq group_path(Group.find_by(name: 'Samurai'))
57 58 59
  end

  step 'I should see newly created group "Samurai"' do
60 61
    expect(page).to have_content "Samurai"
    expect(page).to have_content "Tokugawa Shogunate"
62
  end
63 64

  step 'I should see the "Can not leave message"' do
65
    expect(page).to have_content "You can not leave Owned group because you're the last owner"
66
  end
67
end