Class: Tests::PretendController

Inherits:
ApplicationController
  • Object
show all
Includes:
Cms::Acts::ContentPage
Defined in:
app/controllers/tests/pretend_controller.rb

Overview

This class exists to provide a test for including page behavior in controllers. I didn't know of a way to add functional tests for controllers/routes that aren't in the apps directory.

This should be moved to the test directory if possible.

Constant Summary collapse

RESTRICTED_H1 =
"Restricted"

Instance Method Summary collapse

Methods included from Cms::Acts::ContentPage

#check_access_to_section, #determine_page_layout, #page_title=

Instance Method Details

#errorObject

Raises:

  • (StandardError)


21
22
23
# File 'app/controllers/tests/pretend_controller.rb', line 21

def error
  raise StandardError     
end

#not_foundObject

Raises:

  • (ActiveRecord::RecordNotFound)


25
26
27
# File 'app/controllers/tests/pretend_controller.rb', line 25

def not_found
  raise ActiveRecord::RecordNotFound.new("This thing was missing!")
end

#openObject



17
18
19
# File 'app/controllers/tests/pretend_controller.rb', line 17

def open
  render :text =>"<h1>Open Page</h1> You can see this public page."   
end

#open_with_layoutObject



29
30
31
# File 'app/controllers/tests/pretend_controller.rb', line 29

def open_with_layout
  render :layout=>"templates/subpage"
end

#restrictedObject



13
14
15
# File 'app/controllers/tests/pretend_controller.rb', line 13

def restricted
  render :text =>"<h1>#{RESTRICTED_H1}</h1> You can see this restricted page."
end