Class: Spec::Rails::Example::CookiesProxy
- Inherits:
-
Object
- Object
- Spec::Rails::Example::CookiesProxy
- Defined in:
- lib/spec/rails/example/cookies_proxy.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #[]=(name, value) ⇒ Object
- #delete(name) ⇒ Object
-
#initialize(example) ⇒ CookiesProxy
constructor
A new instance of CookiesProxy.
Constructor Details
#initialize(example) ⇒ CookiesProxy
Returns a new instance of CookiesProxy.
7 8 9 |
# File 'lib/spec/rails/example/cookies_proxy.rb', line 7 def initialize(example) @example = example end |
Instance Method Details
#[](name) ⇒ Object
19 20 21 |
# File 'lib/spec/rails/example/cookies_proxy.rb', line 19 def [](name) @example.response.[name.to_s] end |
#[]=(name, value) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/spec/rails/example/cookies_proxy.rb', line 11 def[]=(name, value) if ::Rails::VERSION::STRING >= '2.3' @example.request.[name.to_s] = value else @example.request.[name.to_s] = CGI::Cookie.new(name.to_s, value) end end |
#delete(name) ⇒ Object
23 24 25 |
# File 'lib/spec/rails/example/cookies_proxy.rb', line 23 def delete(name) @example.response..delete(name.to_s) end |