fix for public snippet
This commit is contained in:
parent
c6efa56ee7
commit
705652d625
5 changed files with 33 additions and 2 deletions
|
@ -9,7 +9,7 @@ class SnippetsController < ApplicationController
|
||||||
|
|
||||||
before_filter :set_title
|
before_filter :set_title
|
||||||
|
|
||||||
skip_before_filter :authenticate_user!, only: [:index, :user_index]
|
skip_before_filter :authenticate_user!, only: [:index, :user_index, :show]
|
||||||
|
|
||||||
respond_to :html
|
respond_to :html
|
||||||
|
|
||||||
|
|
5
features/snippets/public_snippets.feature
Normal file
5
features/snippets/public_snippets.feature
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
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"
|
|
@ -51,4 +51,13 @@ module SharedSnippet
|
||||||
visibility_level: Snippet::PUBLIC,
|
visibility_level: Snippet::PUBLIC,
|
||||||
author: current_user)
|
author: current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
step 'There is public "Personal snippet one" snippet' do
|
||||||
|
create(:personal_snippet,
|
||||||
|
title: "Personal snippet one",
|
||||||
|
content: "Test content",
|
||||||
|
file_name: "snippet.rb",
|
||||||
|
visibility_level: Snippet::PUBLIC,
|
||||||
|
author: create(:user))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
17
features/steps/snippets/public_snippets.rb
Normal file
17
features/steps/snippets/public_snippets.rb
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
class Spinach::Features::PublicSnippets < Spinach::FeatureSteps
|
||||||
|
include SharedAuthentication
|
||||||
|
include SharedPaths
|
||||||
|
include SharedSnippet
|
||||||
|
|
||||||
|
step 'I should see snippet "Personal snippet one"' do
|
||||||
|
page.should have_no_xpath("//i[@class='public-snippet']")
|
||||||
|
end
|
||||||
|
|
||||||
|
step 'I visit snippet page "Personal snippet one"' do
|
||||||
|
visit snippet_path(snippet)
|
||||||
|
end
|
||||||
|
|
||||||
|
def snippet
|
||||||
|
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue