Fix raw view for public snippets

This commit is contained in:
Valery Sizov 2014-10-27 11:51:31 +02:00
parent 6280b53f30
commit 40c8f159a2
3 changed files with 14 additions and 1 deletions

View File

@ -9,7 +9,7 @@ class SnippetsController < ApplicationController
before_filter :set_title
skip_before_filter :authenticate_user!, only: [:index, :user_index, :show]
skip_before_filter :authenticate_user!, only: [:index, :user_index, :show, :raw]
respond_to :html

View File

@ -3,3 +3,8 @@ Feature: 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

@ -7,10 +7,18 @@ class Spinach::Features::PublicSnippets < Spinach::FeatureSteps
page.should have_no_xpath("//i[@class='public-snippet']")
end
step 'I should see raw snippet "Personal snippet one"' do
page.should 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