diff options
author | the-undefined <joe@joejames.io> | 2016-11-19 06:12:47 +0000 |
---|---|---|
committer | the-undefined <joe@joejames.io> | 2017-01-16 06:52:18 +0000 |
commit | 256a55d47be7838bbc061ddf9feb04b76e2a15ca (patch) | |
tree | c2872aa9f6b00ee35e53bc84e0b30b85aac9a182 /spec/features/snippets | |
parent | bf8e174f0ae21b320c17b5a8f8d45aefcfef9520 (diff) | |
download | gitlab-ce-256a55d47be7838bbc061ddf9feb04b76e2a15ca.tar.gz |
Move 'User Snippets' Spinach feature to Rspec
This commit moves the `snippets/user.feature` Spinach test to a
Rspec feature, as part of deprecating the Spinach test suite.
- Remove Spinach discover snippets feature and steps
- Add Rspec feature test
Diffstat (limited to 'spec/features/snippets')
-rw-r--r-- | spec/features/snippets/user_snippets_spec.rb | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/spec/features/snippets/user_snippets_spec.rb b/spec/features/snippets/user_snippets_spec.rb new file mode 100644 index 00000000000..191c2fb9a22 --- /dev/null +++ b/spec/features/snippets/user_snippets_spec.rb @@ -0,0 +1,49 @@ +require 'rails_helper' + +feature 'User Snippets', feature: true do + let(:author) { create(:user) } + let!(:public_snippet) { create(:personal_snippet, :public, author: author, title: "This is a public snippet") } + let!(:internal_snippet) { create(:personal_snippet, :internal, author: author, title: "This is an internal snippet") } + let!(:private_snippet) { create(:personal_snippet, :private, author: author, title: "This is a private snippet") } + + background do + login_as author + visit dashboard_snippets_path + end + + scenario 'View all of my snippets' do + expect(page).to have_content(public_snippet.title) + expect(page).to have_content(internal_snippet.title) + expect(page).to have_content(private_snippet.title) + end + + scenario 'View my public snippets' do + page.within('.snippet-scope-menu') do + click_link "Public" + end + + expect(page).to have_content(public_snippet.title) + expect(page).not_to have_content(internal_snippet.title) + expect(page).not_to have_content(private_snippet.title) + end + + scenario 'View my internal snippets' do + page.within('.snippet-scope-menu') do + click_link "Internal" + end + + expect(page).not_to have_content(public_snippet.title) + expect(page).to have_content(internal_snippet.title) + expect(page).not_to have_content(private_snippet.title) + end + + scenario 'View my private snippets' do + page.within('.snippet-scope-menu') do + click_link "Private" + end + + expect(page).not_to have_content(public_snippet.title) + expect(page).not_to have_content(internal_snippet.title) + expect(page).to have_content(private_snippet.title) + end +end |