From 40c8f159a24b661e9f27dfcde492c4d2a6bbfbe2 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Mon, 27 Oct 2014 11:51:31 +0200 Subject: Fix raw view for public snippets --- app/controllers/snippets_controller.rb | 2 +- features/snippets/public_snippets.feature | 5 +++++ features/steps/snippets/public_snippets.rb | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/controllers/snippets_controller.rb b/app/controllers/snippets_controller.rb index 987694260c6..bf3312fedc8 100644 --- a/app/controllers/snippets_controller.rb +++ b/app/controllers/snippets_controller.rb @@ -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 diff --git a/features/snippets/public_snippets.feature b/features/snippets/public_snippets.feature index 6964badc413..c2afb63b6d8 100644 --- a/features/snippets/public_snippets.feature +++ b/features/snippets/public_snippets.feature @@ -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" diff --git a/features/steps/snippets/public_snippets.rb b/features/steps/snippets/public_snippets.rb index 956aa4a3e7e..67669dc0a69 100644 --- a/features/steps/snippets/public_snippets.rb +++ b/features/steps/snippets/public_snippets.rb @@ -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 -- cgit v1.2.1