Class: Tests::PretendController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tests::PretendController
- 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
Instance Method Details
#error ⇒ Object
21 22 23 |
# File 'app/controllers/tests/pretend_controller.rb', line 21 def error raise StandardError end |
#not_found ⇒ Object
25 26 27 |
# File 'app/controllers/tests/pretend_controller.rb', line 25 def not_found raise ActiveRecord::RecordNotFound.new("This thing was missing!") end |
#open ⇒ Object
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_layout ⇒ Object
29 30 31 |
# File 'app/controllers/tests/pretend_controller.rb', line 29 def open_with_layout render :layout=>"templates/subpage" end |
#restricted ⇒ Object
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 |