summaryrefslogtreecommitdiff
path: root/features/steps/snippets/user.rb
blob: 997c605bce2e595787fd5d8c6ba32273d105592a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class Spinach::Features::SnippetsUser < Spinach::FeatureSteps
  include SharedAuthentication
  include SharedPaths
  include SharedSnippet

  step 'I visit my snippets page' do
    visit dashboard_snippets_path
  end

  step 'I should see "Personal snippet one" in snippets' do
    expect(page).to have_content "Personal snippet one"
  end

  step 'I should see "Personal snippet private" in snippets' do
    expect(page).to have_content "Personal snippet private"
  end

  step 'I should see "Personal snippet internal" in snippets' do
    expect(page).to have_content "Personal snippet internal"
  end

  step 'I should not see "Personal snippet one" in snippets' do
    expect(page).not_to have_content "Personal snippet one"
  end

  step 'I should not see "Personal snippet private" in snippets' do
    expect(page).not_to have_content "Personal snippet private"
  end

  step 'I should not see "Personal snippet internal" in snippets' do
    expect(page).not_to have_content "Personal snippet internal"
  end

  step 'I click "Internal" filter' do
    page.within('.snippet-scope-menu') do
      click_link "Internal"
    end
  end

  step 'I click "Private" filter' do
    page.within('.snippet-scope-menu') do
      click_link "Private"
    end
  end

  step 'I click "Public" filter' do
    page.within('.snippet-scope-menu') do
      click_link "Public"
    end
  end

  def snippet
    @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
  end
end