Updated to latest rspec
[gitorious:georgyos-clone.git] / vendor / plugins / rspec-rails / spec_resources / controllers / controller_spec_controller.rb
1 class ControllerSpecController < ActionController::Base
2   if ['edge','2.0.0'].include?(ENV['RSPEC_RAILS_VERSION'])
3     set_view_path [File.join(File.dirname(__FILE__), "..", "views")]
4   else
5     set_view_path File.join(File.dirname(__FILE__), "..", "views")
6   end
7   
8   def some_action
9     render :template => "template/that/does/not/actually/exist"
10   end
11   
12   def action_with_template
13     render :template => "controller_spec/action_with_template"
14   end
15   
16   def action_which_sets_flash
17     flash[:flash_key] = "flash value"
18     render :text => ""
19   end
20   
21   def action_which_gets_session
22     raise "expected #{params[:session_key].inspect}\ngot #{session[:session_key].inspect}" unless (session[:session_key] == params[:expected])
23     render :text => ""
24   end
25   
26   def action_which_sets_session
27     session[:session_key] = "session value"
28   end
29       
30   def action_with_partial
31     render :partial => "controller_spec/partial"
32   end
33   
34   def action_with_partial_with_object
35     render :partial => "controller_spec/partial", :object => params[:thing]
36   end
37   
38   def action_with_partial_with_locals
39     render :partial => "controller_spec/partial", :locals => {:thing => params[:thing]}
40   end
41   
42   def action_with_errors_in_template
43     render :template => "controller_spec/action_with_errors_in_template"
44   end
45
46   def action_setting_the_assigns_hash
47     assigns['direct_assigns_key'] = :direct_assigns_key_value
48     @indirect_assigns_key = :indirect_assigns_key_value
49   end
50   
51   def action_setting_flash_after_session_reset
52     reset_session
53     flash[:after_reset] = "available"
54   end
55   
56   def action_setting_flash_before_session_reset
57     flash[:before_reset] = 'available'
58     reset_session
59   end
60   
61   def action_with_render_update
62     render :update do |page|
63       page.replace :bottom, 'replace_me',
64                             :partial => 'non_existent_partial'
65     end
66   end
67 end
68