Class: MockedHttpSession

Inherits:
Object
  • Object
show all
Includes:
HttpSession
Defined in:
lib/spec/vraptor/mocked_http_session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, map, id) ⇒ MockedHttpSession

Returns a new instance of MockedHttpSession.



9
10
11
12
13
# File 'lib/spec/vraptor/mocked_http_session.rb', line 9

def initialize(context, map, id)
  @context = context
  @attributes = map
  @id = id
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



3
4
5
# File 'lib/spec/vraptor/mocked_http_session.rb', line 3

def attributes
  @attributes
end

#contextObject

Returns the value of attribute context.



3
4
5
# File 'lib/spec/vraptor/mocked_http_session.rb', line 3

def context
  @context
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/spec/vraptor/mocked_http_session.rb', line 3

def id
  @id
end

Instance Method Details

#get_attribute(x) ⇒ Object



19
20
21
# File 'lib/spec/vraptor/mocked_http_session.rb', line 19

def get_attribute(x)
  @attributes[x]  
end

#get_idObject



5
6
7
# File 'lib/spec/vraptor/mocked_http_session.rb', line 5

def get_id
  @id
end

#get_servlet_contextObject



23
24
25
# File 'lib/spec/vraptor/mocked_http_session.rb', line 23

def get_servlet_context
  @context
end

#remove_attribute(key) ⇒ Object



27
28
29
# File 'lib/spec/vraptor/mocked_http_session.rb', line 27

def remove_attribute(key)
  @attributes.delete(key)
end

#set_attribute(x, y) ⇒ Object



15
16
17
# File 'lib/spec/vraptor/mocked_http_session.rb', line 15

def set_attribute(x, y)
  @attributes.merge!({x => y})
end