Class: Web2Go::MockResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/Web2Go/MockResponse.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMockResponse


14
15
16
17
18
# File 'lib/Web2Go/MockResponse.rb', line 14

def initialize
  @content_type = 'text/html'
  @cookies = { }
  @failed = false
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body


9
10
11
# File 'lib/Web2Go/MockResponse.rb', line 9

def body
  @body
end

#content_typeObject

Returns the value of attribute content_type


10
11
12
# File 'lib/Web2Go/MockResponse.rb', line 10

def content_type
  @content_type
end

#cookiesObject

Returns the value of attribute cookies


12
13
14
# File 'lib/Web2Go/MockResponse.rb', line 12

def cookies
  @cookies
end

#redirect_toObject

Returns the value of attribute redirect_to


11
12
13
# File 'lib/Web2Go/MockResponse.rb', line 11

def redirect_to
  @redirect_to
end

Instance Method Details


24
25
26
# File 'lib/Web2Go/MockResponse.rb', line 24

def add_cookie(name,value,domain=nil,path=nil,expires=nil)
  @cookies[name] = MockCookie.new(name,value,domain,expires)
end

#failedObject


28
29
30
# File 'lib/Web2Go/MockResponse.rb', line 28

def failed
  @failed = true
end

#failed?Boolean


32
33
34
# File 'lib/Web2Go/MockResponse.rb', line 32

def failed?
  @failed
end

20
21
22
# File 'lib/Web2Go/MockResponse.rb', line 20

def set_cookie(cookie)
  @cookies[cookie.name] = cookie
end