Move 'Explore Snippets' Spinach feature to Rspec

This commit moves the `snippets/discover.feature` Spinach test to a
Rspec feature, as part of deprecating the Spinach test suite.

The original feature was called 'Discover Snippets', but the UI no
longer reflects this wording. The new Rspec feature is called
'Explore Snippets' to reflect UI/Controller/View naming in use.

- Remove Spinach discover snippets feature and steps
- Add Rspec feature test
This commit is contained in:
the-undefined 2016-11-07 08:01:27 +00:00
parent a6b4975724
commit 903431e889
3 changed files with 16 additions and 34 deletions

View File

@ -1,13 +0,0 @@
@snippets
Feature: Snippets Discover
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 snippets
Given I visit snippets page
Then I should see "Personal snippet one" in snippets
And I should see "Personal snippet internal" in snippets
And I should not see "Personal snippet private" in snippets

View File

@ -1,21 +0,0 @@
class Spinach::Features::SnippetsDiscover < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedSnippet
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 internal" in snippets' do
expect(page).to have_content "Personal snippet internal"
end
step 'I should not see "Personal snippet private" in snippets' do
expect(page).not_to have_content "Personal snippet private"
end
def snippet
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
end
end

View File

@ -0,0 +1,16 @@
require 'rails_helper'
feature 'Explore Snippets', feature: true do
scenario 'User should see snippets that are not private' do
public_snippet = create(:personal_snippet, :public)
internal_snippet = create(:personal_snippet, :internal)
private_snippet = create(:personal_snippet, :private)
login_as create(:user)
visit explore_snippets_path
expect(page).to have_content(public_snippet.title)
expect(page).to have_content(internal_snippet.title)
expect(page).not_to have_content(private_snippet.title)
end
end