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
This commit is contained in:
parent
bf8e174f0a
commit
256a55d47b
3 changed files with 49 additions and 89 deletions
|
@ -1,34 +0,0 @@
|
|||
@snippets
|
||||
Feature: Snippets User
|
||||
Background:
|
||||
Given I sign in as a user
|
||||
And I have public "Personal snippet one" snippet
|
||||
And I have private "Personal snippet private" snippet
|
||||
And I have internal "Personal snippet internal" snippet
|
||||
|
||||
Scenario: I should see all my snippets
|
||||
Given I visit my snippets page
|
||||
Then I should see "Personal snippet one" in snippets
|
||||
And I should see "Personal snippet private" in snippets
|
||||
And I should see "Personal snippet internal" in snippets
|
||||
|
||||
Scenario: I can see only my private snippets
|
||||
Given I visit my snippets page
|
||||
And I click "Private" filter
|
||||
Then I should not see "Personal snippet one" in snippets
|
||||
And I should not see "Personal snippet internal" in snippets
|
||||
And I should see "Personal snippet private" in snippets
|
||||
|
||||
Scenario: I can see only my public snippets
|
||||
Given I visit my snippets page
|
||||
And I click "Public" filter
|
||||
Then I should see "Personal snippet one" in snippets
|
||||
And I should not see "Personal snippet private" in snippets
|
||||
And I should not see "Personal snippet internal" in snippets
|
||||
|
||||
Scenario: I can see only my internal snippets
|
||||
Given I visit my snippets page
|
||||
And I click "Internal" filter
|
||||
Then I should see "Personal snippet internal" in snippets
|
||||
And I should not see "Personal snippet private" in snippets
|
||||
And I should not see "Personal snippet one" in snippets
|
|
@ -1,55 +0,0 @@
|
|||
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
|
49
spec/features/snippets/user_snippets_spec.rb
Normal file
49
spec/features/snippets/user_snippets_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue