Skip to content
Browse files

Make preview methods act as get

  • Loading branch information...
1 parent 03cc9ba commit b59902594a3db5b4be1f43f6075e5cf718078a6a @cradle cradle committed
Showing with 7 additions and 0 deletions.
  1. +1 −0 app/controllers/preview_controller.rb
  2. +6 −0 spec/controllers/preview_controller_spec.rb
View
1 app/controllers/preview_controller.rb
@@ -5,6 +5,7 @@ class PreviewController < ApplicationController
def show
Page.transaction do # Extra safe don't save anything voodoo
PagePart.transaction do
+ def request.request_method; :get; end
construct_page.process(request,response)
@performed_render = true
raise "Don't you dare save any changes"
View
6 spec/controllers/preview_controller_spec.rb
@@ -6,6 +6,7 @@ class TestPage < Page
describe PreviewController do
scenario :users, :home_page
before(:each) do
+ controller.stub! :verify_authenticity_token
login_as :admin
end
@@ -14,6 +15,11 @@ class TestPage < Page
controller.should_receive(:construct_page).and_return(mock('page', :process => true))
post :show
end
+
+ it 'should modify the request such that it is a get' do
+ post :show
+ request.method.should == :get
+ end
it 'should test that it does not modify page'
it 'should test that it renders exceptions'

0 comments on commit b599025

Please sign in to comment.
Something went wrong with that request. Please try again.