Updated Rails to 2.1.0
[gitorious:georgyos-clone.git] / vendor / plugins / rspec_on_rails / lib / spec / rails / example / functional_example_group.rb
1 module Spec
2   module Rails
3     module Example
4       class FunctionalExampleGroup < RailsExampleGroup
5         include ActionController::TestProcess
6         include ActionController::Assertions
7
8         attr_reader :request, :response
9         before(:each) do
10           @controller_class = Object.path2class @controller_class_name
11           raise "Can't determine controller class for #{@controller_class_name}" if @controller_class.nil?
12
13           @controller = @controller_class.new
14
15           @request = ActionController::TestRequest.new
16           @response = ActionController::TestResponse.new
17         end
18
19         def params
20           request.parameters
21         end
22
23         def flash
24           response.flash
25         end
26
27         def session
28           request.session
29         end
30
31         # :call-seq:
32         #   assigns()
33         #
34         # Hash of instance variables to values that are made available to
35         # views. == Examples
36         #
37         #   #in thing_controller.rb
38         #   def new
39         #     @thing = Thing.new
40         #   end
41         #
42         #   #in thing_controller_spec
43         #   get 'new'
44         #   assigns[:registration].should == Thing.new
45         #--
46         # NOTE - Even though docs only use assigns[:key] format, this supports
47         # assigns(:key) in order to avoid breaking old specs.
48         #++
49         def assigns(key = nil)
50           if key.nil?
51             _assigns_hash_proxy
52           else
53             _assigns_hash_proxy[key]
54           end
55         end
56       end
57     end
58   end
59 end