dcrec1-rspec-vraptor 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/environment.rb +11 -6
- data/lib/spec/vraptor/{mocked_request.rb → mocked_http_request.rb} +11 -3
- data/lib/spec/vraptor/{mocked_session.rb → mocked_http_session.rb} +5 -1
- data/lib/spec/vraptor/{mocked_dispatcher.rb → mocked_request_dispatcher.rb} +1 -1
- data/lib/spec/vraptor/{mocked_context.rb → mocked_servlet_context.rb} +1 -1
- data/lib/spec/vraptor.rb +3 -3
- metadata +6 -6
data/Rakefile
CHANGED
data/lib/environment.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'spec'
|
2
3
|
require 'rhyme'
|
3
4
|
|
@@ -12,9 +13,13 @@ import org.vraptor.VRaptorFilter
|
|
12
13
|
import java.util.HashSet
|
13
14
|
import java.util.Locale
|
14
15
|
|
15
|
-
|
16
|
-
require
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
16
|
+
def req(x)
|
17
|
+
require File.dirname(__FILE__) + "/spec/vraptor/mocked_#{x}"
|
18
|
+
end
|
19
|
+
|
20
|
+
req 'config'
|
21
|
+
req 'http_session'
|
22
|
+
req 'http_request'
|
23
|
+
req 'request_dispatcher'
|
24
|
+
req 'response'
|
25
|
+
req 'servlet_context'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class MockedHttpRequest
|
2
2
|
include HttpServletRequest
|
3
3
|
attr_accessor :dispatcher, :session, :request_uri, :parameter_map, :headers, :attributes, :locale
|
4
4
|
|
@@ -6,7 +6,7 @@ class MockedRequest
|
|
6
6
|
@locale = locale
|
7
7
|
@attributes = injection
|
8
8
|
@headers = {'Host' => '72.14.205.100'}.merge! headers
|
9
|
-
@dispatcher, @session, @request_uri, @parameter_map =
|
9
|
+
@dispatcher, @session, @request_uri, @parameter_map = MockedRequestDispatcher.new, session, uri, map
|
10
10
|
end
|
11
11
|
|
12
12
|
def get_request_dispatcher(x)
|
@@ -26,7 +26,15 @@ class MockedRequest
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def get_context_path
|
29
|
-
""
|
29
|
+
"myapp"
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_server_name
|
33
|
+
'localhost'
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_server_port
|
37
|
+
80
|
30
38
|
end
|
31
39
|
|
32
40
|
def get_parameter_map
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class MockedHttpSession
|
2
2
|
include HttpSession
|
3
3
|
attr_accessor :attributes, :context, :id
|
4
4
|
|
@@ -23,4 +23,8 @@ class MockedSession
|
|
23
23
|
def get_servlet_context
|
24
24
|
@context
|
25
25
|
end
|
26
|
+
|
27
|
+
def remove_attribute(key)
|
28
|
+
@attributes.delete(key)
|
29
|
+
end
|
26
30
|
end
|
data/lib/spec/vraptor.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'environment'
|
1
|
+
require File.dirname(__FILE__) + '/../environment'
|
2
2
|
|
3
3
|
def get(x, params_request = {}, params_session = {}, injection = {}, headers = {})
|
4
4
|
init
|
5
5
|
@response = MockedResponse.new
|
6
6
|
dispatcher = MockedRequestDispatcher.new
|
7
7
|
@session = MockedHttpSession.new($context, params_session, @session_id)
|
8
|
-
@request =
|
9
|
-
|
8
|
+
@request = MockedHttpRequest.new(dispatcher, @session, x, Rhyme.translate(params_request), injection, headers, Locale.new('en', 'US'))
|
9
|
+
|
10
10
|
$filter.do_filter(@request, @response, $chain)
|
11
11
|
end
|
12
12
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dcrec1-rspec-vraptor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Carrion
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01-
|
12
|
+
date: 2009-01-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -23,12 +23,12 @@ extra_rdoc_files: []
|
|
23
23
|
|
24
24
|
files:
|
25
25
|
- lib/spec/vraptor.rb
|
26
|
-
- lib/spec/vraptor/mocked_session.rb
|
27
26
|
- lib/spec/vraptor/mocked_response.rb
|
28
27
|
- lib/spec/vraptor/mocked_config.rb
|
29
|
-
- lib/spec/vraptor/
|
30
|
-
- lib/spec/vraptor/
|
31
|
-
- lib/spec/vraptor/
|
28
|
+
- lib/spec/vraptor/mocked_http_session.rb
|
29
|
+
- lib/spec/vraptor/mocked_request_dispatcher.rb
|
30
|
+
- lib/spec/vraptor/mocked_servlet_context.rb
|
31
|
+
- lib/spec/vraptor/mocked_http_request.rb
|
32
32
|
- lib/environment.rb
|
33
33
|
- README.textile
|
34
34
|
- Rakefile
|