dcrec1-rspec-vraptor 0.9.5 → 0.9.6
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/README.textile +0 -10
- data/Rakefile +22 -3
- data/lib/environment.rb +11 -2
- data/lib/spec/vraptor/mocked_http_request.rb +1 -1
- data/lib/spec/vraptor/mocked_servlet_context.rb +11 -24
- data/lib/spec/vraptor.rb +1 -1
- metadata +1 -1
- data/lib/spec/vraptor/mocked_config.rb +0 -13
data/README.textile
CHANGED
@@ -43,16 +43,6 @@ end</code></pre>
|
|
43
43
|
|
44
44
|
h2. SPECING:
|
45
45
|
|
46
|
-
Before running specs:
|
47
|
-
|
48
|
-
If you are using linux
|
49
|
-
<pre><code>export CLASSPATH=inc/servlet-api-2.5.jar:inc/vraptor-2.6.3.jar:inc/log4j-1.2.12.jar</code></pre>
|
50
|
-
|
51
|
-
If you are using windows
|
52
|
-
<pre><code>set CLASSPATH=inc\servlet-api-2.5.jar;inc\vraptor-2.6.3.jar;inc\log4j-1.2.12.jar</code></pre>
|
53
|
-
|
54
|
-
Then to spec:
|
55
|
-
|
56
46
|
<pre><code>jruby -S rake spec</code></pre>
|
57
47
|
|
58
48
|
h2. LICENSE:
|
data/Rakefile
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
$CLASSPATH << 'inc/log4j-1.2.12.jar'
|
2
|
+
$CLASSPATH << 'inc/servlet-api-2.5.jar'
|
3
|
+
|
1
4
|
require 'rubygems'
|
2
5
|
require 'rubygems/specification'
|
3
6
|
require 'rake'
|
@@ -5,8 +8,8 @@ require 'rake/gempackagetask'
|
|
5
8
|
require 'spec/rake/spectask'
|
6
9
|
|
7
10
|
GEM = "rspec-vraptor"
|
8
|
-
GEM_VERSION = "0.9.
|
9
|
-
SUMMARY = "RSpec for VRaptor Sexy URLs"
|
11
|
+
GEM_VERSION = "0.9.6"
|
12
|
+
SUMMARY = "RSpec for VRaptor Sexy/Nice URLs"
|
10
13
|
AUTHOR = "Diego Carrion"
|
11
14
|
EMAIL = "dc.rec1@gmail.com"
|
12
15
|
HOMEPAGE = "http://www.diegocarrion.com"
|
@@ -26,10 +29,26 @@ spec = Gem::Specification.new do |s|
|
|
26
29
|
s.rubyforge_project = GEM # GitHub bug, gem isn't being build when this miss
|
27
30
|
end
|
28
31
|
|
29
|
-
Spec::Rake::SpecTask.new do |t|
|
32
|
+
Spec::Rake::SpecTask.new('spec') do |t|
|
30
33
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
31
34
|
t.spec_opts = %w(--color)
|
32
35
|
end
|
36
|
+
|
37
|
+
task :set_sexy do
|
38
|
+
$CLASSPATH << 'inc/vraptor-2.6.3.jar'
|
39
|
+
$CLASSPATH << 'inc/picocontainer-1.3.jar'
|
40
|
+
end
|
41
|
+
|
42
|
+
task :set_nice do
|
43
|
+
$CLASSPATH << 'inc/vraptor-2.6.0.jar'
|
44
|
+
$CLASSPATH << 'inc/picocontainer-2.7.jar'
|
45
|
+
end
|
46
|
+
|
47
|
+
desc "Run specs for VRaptor Nice URLs"
|
48
|
+
task :'spec:nice' => [:set_nice, :spec]
|
49
|
+
|
50
|
+
desc "Run specs for VRaptor Sexy URLs"
|
51
|
+
task :'spec:sexy' => [:set_sexy, :spec]
|
33
52
|
|
34
53
|
Rake::GemPackageTask.new(spec) do |pkg|
|
35
54
|
pkg.gem_spec = spec
|
data/lib/environment.rb
CHANGED
@@ -10,7 +10,16 @@ import javax.servlet.FilterConfig
|
|
10
10
|
import javax.servlet.FilterChain
|
11
11
|
import javax.servlet.ServletContext
|
12
12
|
import javax.servlet.RequestDispatcher
|
13
|
-
|
13
|
+
begin
|
14
|
+
import org.vraptor.VRaptorFilter
|
15
|
+
rescue
|
16
|
+
$VRAPTOR_VERSION = "Nice"
|
17
|
+
end
|
18
|
+
begin
|
19
|
+
import org.vraptor.plugin.niceurls.NiceURLFilter
|
20
|
+
rescue
|
21
|
+
$VRAPTOR_VERSION = "Sexy"
|
22
|
+
end
|
14
23
|
import java.util.HashSet
|
15
24
|
import java.util.Locale
|
16
25
|
|
@@ -23,7 +32,7 @@ def req_mocked(x)
|
|
23
32
|
end
|
24
33
|
|
25
34
|
req 'matchers'
|
26
|
-
req_mocked '
|
35
|
+
req_mocked 'filter_config'
|
27
36
|
req_mocked 'http_session'
|
28
37
|
req_mocked 'http_request'
|
29
38
|
req_mocked 'http_response'
|
@@ -6,7 +6,7 @@ class MockedHttpRequest
|
|
6
6
|
@locale = locale
|
7
7
|
@attributes = injection
|
8
8
|
@headers = {'Host' => '72.14.205.100'}.merge! headers
|
9
|
-
@context_path = "/
|
9
|
+
@context_path = "/context"
|
10
10
|
@session, @request_uri, @parameter_map = session, @context_path + uri, map
|
11
11
|
@cookies = cookies
|
12
12
|
end
|
@@ -4,11 +4,9 @@ class MockedServletContext
|
|
4
4
|
|
5
5
|
def initialize
|
6
6
|
@attributes = {}
|
7
|
-
@basic_path = java.io.File.new("").get_absolute_path
|
8
7
|
end
|
9
8
|
|
10
9
|
def get_init_parameter(x)
|
11
|
-
nil
|
12
10
|
end
|
13
11
|
|
14
12
|
def get_context(uri_path)
|
@@ -28,32 +26,21 @@ class MockedServletContext
|
|
28
26
|
end
|
29
27
|
|
30
28
|
def get_resource_paths(path)
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
path = path
|
35
|
-
|
36
|
-
|
37
|
-
paths = HashSet.new
|
38
|
-
root_folder.list.each do |file_name|
|
39
|
-
if java.io.File.new(root_folder, file_name).is_directory
|
40
|
-
file_name = file_name + '/'
|
41
|
-
end
|
42
|
-
name = path + file_name
|
43
|
-
if name.include? ".class"
|
44
|
-
name = name.sub("target", "/WEB-INF")
|
45
|
-
end
|
46
|
-
paths.add(name)
|
29
|
+
paths = HashSet.new
|
30
|
+
path = @basic_path = ($CLASSPATH.select {|p| p.include? "classes"})[0].sub("file:", "") if path.eql? "/WEB-INF/classes/"
|
31
|
+
Dir[path + "*"].each do |path|
|
32
|
+
path = path + "/" unless path.include? "."
|
33
|
+
path = path.gsub(@basic_path, "/WEB-INF/classes/") if path.include? ".class"
|
34
|
+
paths.add path
|
47
35
|
end
|
48
36
|
paths
|
49
37
|
end
|
38
|
+
|
39
|
+
def get_resource(x)
|
40
|
+
end
|
50
41
|
|
51
|
-
def get_real_path(
|
52
|
-
|
53
|
-
java.io.File.new("").get_absolute_path + "/" + x
|
54
|
-
else
|
55
|
-
x
|
56
|
-
end
|
42
|
+
def get_real_path(path)
|
43
|
+
path
|
57
44
|
end
|
58
45
|
|
59
46
|
def set_attribute(x, y)
|
data/lib/spec/vraptor.rb
CHANGED
metadata
CHANGED