Commit 27528d44 authored by the-undefined's avatar the-undefined

Move spinach public snippet feature to rspec spec

- Add rspec feature for public snippets
- Remove spinach test for public snippets
parent b27de4ab
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"
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
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment