Class: ControllerSpecController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb

Defined Under Namespace

Classes: RescuedError, UnRescuedError

Instance Method Summary collapse

Instance Method Details

#action_setting_flash_after_session_resetObject



67
68
69
70
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 67

def action_setting_flash_after_session_reset
  reset_session
  flash[:after_reset] = "available"
end

#action_setting_flash_before_session_resetObject



72
73
74
75
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 72

def action_setting_flash_before_session_reset
  flash[:before_reset] = 'available'
  reset_session
end

#action_setting_the_assigns_hashObject



63
64
65
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 63

def action_setting_the_assigns_hash
  @indirect_assigns_key = :indirect_assigns_key_value
end

#action_that_assigns_false_to_a_variableObject



92
93
94
95
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 92

def action_that_assigns_false_to_a_variable
  @a_variable = false
  render :text => ""
end

#action_that_renders_inlineObject



88
89
90
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 88

def action_that_renders_inline
  render :inline => "<%= 'inline code' %>"
end

#action_that_returns_headersObject



118
119
120
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 118

def action_that_returns_headers
  render :text => request.headers[params[:header]]
end


37
38
39
40
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 37

def action_which_gets_cookie
  raise "expected #{params[:expected].inspect}, got #{cookies[:cookie_key].inspect}" unless (cookies[:cookie_key] == params[:expected])
  render :text => ""
end

#action_which_gets_sessionObject



28
29
30
31
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 28

def action_which_gets_session
  raise "expected #{params[:session_key].inspect}\ngot #{session[:session_key].inspect}" unless (session[:session_key] == params[:expected])
  render :text => ""
end


42
43
44
45
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 42

def action_which_sets_cookie
  cookies['cookie_key'] = params[:value]
  render :text => ""
end

#action_which_sets_flashObject



23
24
25
26
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 23

def action_which_sets_flash
  flash[:flash_key] = "flash value"
  render :text => ""
end

#action_which_sets_sessionObject



33
34
35
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 33

def action_which_sets_session
  session[:session_key] = "session value"
end

#action_with_errors_in_templateObject



59
60
61
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 59

def action_with_errors_in_template
  render :template => "controller_spec/action_with_errors_in_template"
end

#action_with_partialObject



47
48
49
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 47

def action_with_partial
  render :partial => "controller_spec/partial"
end

#action_with_partial_with_localsObject



55
56
57
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 55

def action_with_partial_with_locals
  render :partial => "controller_spec/partial", :locals => {:thing => params[:thing]}
end

#action_with_partial_with_objectObject



51
52
53
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 51

def action_with_partial_with_object
  render :partial => "controller_spec/partial", :object => params[:thing]
end

#action_with_render_updateObject



77
78
79
80
81
82
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 77

def action_with_render_update
  render :update do |page|
    page.replace :bottom, 'replace_me',
                          :partial => 'non_existent_partial'
  end
end

#action_with_skipped_before_filterObject



84
85
86
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 84

def action_with_skipped_before_filter
  render :text => ""
end

#action_with_templateObject



19
20
21
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 19

def action_with_template
  render :template => "controller_spec/action_with_template"
end

#action_with_two_arg_renderObject



97
98
99
100
101
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 97

def action_with_two_arg_render
  render :update, :status => 404 do |page|
    page.visual_effect :highlight, 'user_list'
  end
end

#raise_errorObject



4
5
6
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 4

def raise_error
  raise "from a before filter"
end

#rescued_error_actionObject



110
111
112
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 110

def rescued_error_action
  raise ControllerSpecController::RescuedError
end

#some_actionObject



12
13
14
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 12

def some_action
  render :template => "template/that/does/not/actually/exist"
end

#some_action_with_implied_templateObject



16
17
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 16

def some_action_with_implied_template
end

#un_rescued_error_actionObject



114
115
116
# File 'lib/vendor/plugins/rspec-rails/spec/resources/controllers/controller_spec_controller.rb', line 114

def un_rescued_error_action
  raise ControllerSpecController::UnRescuedError
end