Class: MockedServletContext
- Inherits:
-
Object
- Object
- MockedServletContext
- Includes:
- ServletContext
- Defined in:
- lib/spec/vraptor/mocked_servlet_context.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#basic_path ⇒ Object
Returns the value of attribute basic_path.
-
#init_parameters ⇒ Object
Returns the value of attribute init_parameters.
Instance Method Summary collapse
- #get_attribute(x) ⇒ Object
- #get_context(uri_path) ⇒ Object
- #get_init_parameter(x) ⇒ Object
- #get_major_version ⇒ Object
- #get_mime_type(file) ⇒ Object
- #get_minor_version ⇒ Object
- #get_real_path(path) ⇒ Object
- #get_resource(x) ⇒ Object
- #get_resource_paths(path) ⇒ Object
-
#initialize ⇒ MockedServletContext
constructor
A new instance of MockedServletContext.
- #set_attribute(x, y) ⇒ Object
Constructor Details
#initialize ⇒ MockedServletContext
Returns a new instance of MockedServletContext.
5 6 7 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 5 def initialize @attributes = {} end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
3 4 5 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 3 def attributes @attributes end |
#basic_path ⇒ Object
Returns the value of attribute basic_path.
3 4 5 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 3 def basic_path @basic_path end |
#init_parameters ⇒ Object
Returns the value of attribute init_parameters.
3 4 5 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 3 def init_parameters @init_parameters end |
Instance Method Details
#get_attribute(x) ⇒ Object
50 51 52 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 50 def get_attribute(x) @attributes[x] end |
#get_context(uri_path) ⇒ Object
12 13 14 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 12 def get_context(uri_path) nil end |
#get_init_parameter(x) ⇒ Object
9 10 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 9 def get_init_parameter(x) end |
#get_major_version ⇒ Object
16 17 18 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 16 def get_major_version 0 end |
#get_mime_type(file) ⇒ Object
24 25 26 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 24 def get_mime_type(file) nil end |
#get_minor_version ⇒ Object
20 21 22 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 20 def get_minor_version 0 end |
#get_real_path(path) ⇒ Object
42 43 44 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 42 def get_real_path(path) path end |
#get_resource(x) ⇒ Object
39 40 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 39 def get_resource(x) end |
#get_resource_paths(path) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 28 def get_resource_paths(path) paths = HashSet.new path = @basic_path = ($CLASSPATH.select {|p| p.include? "/classes/"})[0].sub("file:", "") if path.eql? "/WEB-INF/classes/" Dir[path + "*"].each do |path| path = path + "/" if File::directory?(path) path = path.gsub(@basic_path, "/WEB-INF/classes/") if path.include? ".class" paths.add path end paths end |
#set_attribute(x, y) ⇒ Object
46 47 48 |
# File 'lib/spec/vraptor/mocked_servlet_context.rb', line 46 def set_attribute(x, y) @attributes.merge!({x => y}) end |