Skip to content
Snippets Groups Projects
Commit 5f7906e1 authored by Valery Sizov's avatar Valery Sizov
Browse files

fix for public snippet

parent e8da077d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -9,7 +9,7 @@ class SnippetsController < ApplicationController
 
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
 
Loading
Loading
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"
Loading
Loading
@@ -25,4 +25,4 @@ Feature: Snippets
Scenario: I destroy "Personal snippet one"
Given I visit snippet page "Personal snippet one"
And I click link "Destroy"
Then I should not see "Personal snippet one" in snippets
Then I should not see "Personal snippet one" in snippets
\ No newline at end of file
Loading
Loading
@@ -51,4 +51,13 @@ module SharedSnippet
visibility_level: Snippet::PUBLIC,
author: current_user)
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
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment