Merge branch 'move-public-snippets-feature-to-rspec' into 'master'

Move Spinach public snippet feature test to RSpec feature

See #23036

See merge request !7256
This commit is contained in:
Robert Speicher 2016-11-05 06:43:05 +00:00
commit 50f3fd49a2
3 changed files with 19 additions and 35 deletions

View file

@ -1,10 +0,0 @@
Feature: Public snippets
Scenario: Unauthenticated user should see public snippets
Given There is public "Personal snippet one" snippet
And I visit snippet page "Personal snippet one"
Then I should see snippet "Personal snippet one"
Scenario: Unauthenticated user should see raw public snippets
Given There is public "Personal snippet one" snippet
And I visit snippet raw page "Personal snippet one"
Then I should see raw snippet "Personal snippet one"

View file

@ -1,25 +0,0 @@
class Spinach::Features::PublicSnippets < Spinach::FeatureSteps
include SharedAuthentication
include SharedPaths
include SharedSnippet
step 'I should see snippet "Personal snippet one"' do
expect(page).to have_no_xpath("//i[@class='public-snippet']")
end
step 'I should see raw snippet "Personal snippet one"' do
expect(page).to have_text(snippet.content)
end
step 'I visit snippet page "Personal snippet one"' do
visit snippet_path(snippet)
end
step 'I visit snippet raw page "Personal snippet one"' do
visit raw_snippet_path(snippet)
end
def snippet
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
end
end

View file

@ -0,0 +1,19 @@
require 'rails_helper'
feature 'Public Snippets', feature: true do
scenario 'Unauthenticated user should see public snippets' do
public_snippet = create(:personal_snippet, :public)
visit snippet_path(public_snippet)
expect(page).to have_content(public_snippet.content)
end
scenario 'Unauthenticated user should see raw public snippets' do
public_snippet = create(:personal_snippet, :public)
visit raw_snippet_path(public_snippet)
expect(page).to have_content(public_snippet.content)
end
end