karl-loris 0.0.7 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.rdoc +9 -1
- data/Rakefile +24 -5
- data/TODO +1 -1
- data/VERSION +1 -1
- data/examples/self_test/jsl.conf +1 -0
- data/features/javascript_lint.feature +34 -0
- data/features/run.feature +1 -2
- data/features/step_definitons/all.rb +8 -0
- data/lib/filters/ends_with_filter.rb +17 -0
- data/lib/{extension_filter.rb → filters/extension_filter.rb} +0 -0
- data/lib/{file_filter.rb → filters/file_filter.rb} +0 -0
- data/lib/{modified_filter.rb → filters/modified_filter.rb} +0 -0
- data/lib/loris.rb +19 -13
- data/lib/tasks/javascript_lint/javascript_lint_runner.rb +21 -0
- data/lib/tasks/{javascript_lint_task.rb → javascript_lint/javascript_lint_task.rb} +9 -8
- data/lib/tasks/js_test_driver/js_test_driver_runner.rb +22 -0
- data/lib/tasks/{js_test_driver_task.rb → js_test_driver/js_test_driver_task.rb} +2 -1
- data/lib/tasks/jspec/jspec_runner.rb +21 -0
- data/lib/tasks/{jspec_task.rb → jspec/jspec_task.rb} +2 -1
- data/lib/tasks/rspec/rspec_runner.rb +21 -0
- data/lib/tasks/rspec/rspec_task.rb +50 -0
- data/loris.gemspec +37 -24
- data/loris.tmproj +74 -44
- data/spec/file_finder_spec.rb +3 -3
- data/spec/filters/ends_with_filter_spec.rb +26 -0
- data/spec/{file_filter_spec.rb → filters/file_filter_spec.rb} +1 -1
- data/spec/{modified_filter_spec.rb → filters/modified_filter_spec.rb} +1 -1
- data/spec/tasks/javascript_lint/javascript_lint_runner_spec.rb +90 -0
- data/spec/tasks/js_test_driver/js_test_driver_runner_spec.rb +91 -0
- data/spec/tasks/jspec/jspec_runner_spec.rb +78 -0
- data/spec/tasks/jspec/jspec_task_spec.rb +45 -0
- metadata +41 -21
- data/.autotest +0 -12
- data/autotest/discover.rb +0 -3
- data/lib/tasks/javascript_lint_runner.rb +0 -15
- data/lib/tasks/js_test_driver_runner.rb +0 -16
- data/lib/tasks/jspec_runner.rb +0 -15
- data/spec/jspec_task_spec.rb +0 -47
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'lib/tasks/javascript_lint/javascript_lint_runner.rb'
|
2
|
+
|
3
|
+
describe JavascriptLintRunner do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@filter = mock('JS Extension Filter')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "is_configured?" do
|
10
|
+
|
11
|
+
it "should return true if jsl.conf exists" do
|
12
|
+
|
13
|
+
dir = '/a/dir/structure'
|
14
|
+
all_files = ['/a/dir/structure/jsl.conf']
|
15
|
+
|
16
|
+
runner = JavascriptLintRunner.new(dir, @filter)
|
17
|
+
|
18
|
+
runner.is_configured?(all_files).should be_true
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return false if jsl.conf does not exists" do
|
23
|
+
|
24
|
+
dir = '/a/dir/structure'
|
25
|
+
all_files = ['/a/dir/structure/other.conf']
|
26
|
+
|
27
|
+
runner = JavascriptLintRunner.new(dir, @filter)
|
28
|
+
|
29
|
+
runner.is_configured?(all_files).should be_false
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "should_run?" do
|
36
|
+
|
37
|
+
it "should return true if a file ends with a js extension" do
|
38
|
+
|
39
|
+
dir = '/a/dir/structure'
|
40
|
+
modified_files = ['/a/dir/structure/another_dir/example.js']
|
41
|
+
@filter.should_receive(:filter).and_return(true)
|
42
|
+
|
43
|
+
runner = JavascriptLintRunner.new(dir, @filter)
|
44
|
+
|
45
|
+
runner.should_run?(modified_files).should be_true
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return true if any file ends with a js extension" do
|
50
|
+
|
51
|
+
dir = '/a/dir/structure'
|
52
|
+
modified_files = ['/a/dir/structure/nonjs.file', '/a/dir/structure/another_dir/example.js']
|
53
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
54
|
+
@filter.should_receive(:filter).ordered.and_return(true)
|
55
|
+
|
56
|
+
runner = JavascriptLintRunner.new(dir, @filter)
|
57
|
+
|
58
|
+
runner.should_run?(modified_files).should be_true
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should return false if no file ends with a js extension" do
|
63
|
+
|
64
|
+
dir = '/a/dir/structure'
|
65
|
+
modified_files = ['/a/dir/structure/nonjs.file']
|
66
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
67
|
+
|
68
|
+
runner = JavascriptLintRunner.new(dir, @filter)
|
69
|
+
|
70
|
+
runner.should_run?(modified_files).should be_false
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should return true if the jsl.conf file was modified" do
|
75
|
+
|
76
|
+
dir = '/a/dir/structure'
|
77
|
+
modified_files = ['/a/dir/structure/jsl.conf']
|
78
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
79
|
+
|
80
|
+
runner = JavascriptLintRunner.new(dir, @filter)
|
81
|
+
|
82
|
+
runner.should_run?(modified_files).should be_true
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'lib/tasks/js_test_driver/js_test_driver_runner.rb'
|
2
|
+
|
3
|
+
describe JsTestDriverRunner do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@jar = '/path/to/jsTestDriver.jar'
|
7
|
+
@filter = mock('JS Extension Filter')
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "is_configured?" do
|
11
|
+
|
12
|
+
it "should return true if jsTestDriver.conf exists" do
|
13
|
+
|
14
|
+
dir = '/a/dir/structure'
|
15
|
+
all_files = ['/a/dir/structure/jsTestDriver.conf']
|
16
|
+
|
17
|
+
runner = JsTestDriverRunner.new(dir, @jar, @filter)
|
18
|
+
|
19
|
+
runner.is_configured?(all_files).should be_true
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return false if jsl.conf does not exists" do
|
24
|
+
|
25
|
+
dir = '/a/dir/structure'
|
26
|
+
all_files = ['/a/dir/structure/other.conf']
|
27
|
+
|
28
|
+
runner = JsTestDriverRunner.new(dir, @jar, @filter)
|
29
|
+
|
30
|
+
runner.is_configured?(all_files).should be_false
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "should_run?" do
|
37
|
+
|
38
|
+
it "should return true if a file ends with a js extension" do
|
39
|
+
|
40
|
+
dir = '/a/dir/structure'
|
41
|
+
modified_files = ['/a/dir/structure/another_dir/example.js']
|
42
|
+
@filter.should_receive(:filter).and_return(true)
|
43
|
+
|
44
|
+
runner = JsTestDriverRunner.new(dir, @jar, @filter)
|
45
|
+
|
46
|
+
runner.should_run?(modified_files).should be_true
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should return true if any file ends with a js extension" do
|
51
|
+
|
52
|
+
dir = '/a/dir/structure'
|
53
|
+
modified_files = ['/a/dir/structure/nonjs.file', '/a/dir/structure/another_dir/example.js']
|
54
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
55
|
+
@filter.should_receive(:filter).ordered.and_return(true)
|
56
|
+
|
57
|
+
runner = JsTestDriverRunner.new(dir, @jar, @filter)
|
58
|
+
|
59
|
+
runner.should_run?(modified_files).should be_true
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return false if no file ends with a js extension" do
|
64
|
+
|
65
|
+
dir = '/a/dir/structure'
|
66
|
+
modified_files = ['/a/dir/structure/nonjs.file']
|
67
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
68
|
+
|
69
|
+
runner = JsTestDriverRunner.new(dir, @jar, @filter)
|
70
|
+
|
71
|
+
runner.should_run?(modified_files).should be_false
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return true if the jsTestDriver.conf file was modified" do
|
76
|
+
|
77
|
+
dir = '/a/dir/structure'
|
78
|
+
modified_files = ['/a/dir/structure/jsTestDriver.conf']
|
79
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
80
|
+
|
81
|
+
runner = JsTestDriverRunner.new(dir, @jar, @filter)
|
82
|
+
|
83
|
+
runner.should_run?(modified_files).should be_true
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'lib/tasks/jspec/jspec_runner.rb'
|
2
|
+
|
3
|
+
describe JSpecRunner do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@filter = mock('JS Extension Filter')
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "is_configured?" do
|
10
|
+
|
11
|
+
it "should return true if spec/spec.rhino.js exists" do
|
12
|
+
|
13
|
+
dir = '/a/dir/structure'
|
14
|
+
all_files = ['/a/dir/structure/spec/spec.rhino.js']
|
15
|
+
|
16
|
+
runner = JSpecRunner.new(dir, @filter)
|
17
|
+
|
18
|
+
runner.is_configured?(all_files).should be_true
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return false if spec/spec.rhino.js does not exists" do
|
23
|
+
|
24
|
+
dir = '/a/dir/structure'
|
25
|
+
all_files = ['/a/dir/structure/spec/other_js_spec_file.js']
|
26
|
+
|
27
|
+
runner = JSpecRunner.new(dir, @filter)
|
28
|
+
|
29
|
+
runner.is_configured?(all_files).should be_false
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "should_run?" do
|
36
|
+
|
37
|
+
it "should return true if a file ends with a js extension" do
|
38
|
+
|
39
|
+
dir = '/a/dir/structure'
|
40
|
+
modified_files = ['/a/dir/structure/another_dir/example.js']
|
41
|
+
@filter.should_receive(:filter).and_return(true)
|
42
|
+
|
43
|
+
runner = JSpecRunner.new(dir, @filter)
|
44
|
+
|
45
|
+
runner.should_run?(modified_files).should be_true
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return true if any file ends with a js extension" do
|
50
|
+
|
51
|
+
dir = '/a/dir/structure'
|
52
|
+
modified_files = ['/a/dir/structure/nonjs.file', '/a/dir/structure/another_dir/example.js']
|
53
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
54
|
+
@filter.should_receive(:filter).ordered.and_return(true)
|
55
|
+
|
56
|
+
runner = JSpecRunner.new(dir, @filter)
|
57
|
+
|
58
|
+
runner.should_run?(modified_files).should be_true
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should return false if no file ends with a js extension" do
|
63
|
+
|
64
|
+
dir = '/a/dir/structure'
|
65
|
+
modified_files = ['/a/dir/structure/nonjs.file']
|
66
|
+
@filter.should_receive(:filter).ordered.and_return(false)
|
67
|
+
|
68
|
+
runner = JSpecRunner.new(dir, @filter)
|
69
|
+
|
70
|
+
runner.should_run?(modified_files).should be_false
|
71
|
+
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'lib/tasks/jspec/jspec_task.rb'
|
2
|
+
|
3
|
+
describe JSpecTask do
|
4
|
+
|
5
|
+
before do
|
6
|
+
@files = {
|
7
|
+
:all => [],
|
8
|
+
:filtered => []
|
9
|
+
}
|
10
|
+
|
11
|
+
@jspec = mock('JSpec Runner')
|
12
|
+
@jspec.should_receive(:is_configured?).and_return(true)
|
13
|
+
@jspec.should_receive(:should_run?).and_return(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return error if unable to parse jspec output" do
|
17
|
+
@jspec.should_receive(:execute).and_return('A JSpec error message here...')
|
18
|
+
|
19
|
+
jspec_task = JSpecTask.new(@jspec)
|
20
|
+
result = jspec_task.run(@files)
|
21
|
+
|
22
|
+
result[:state].should eql :error
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return success if all tests pass" do
|
26
|
+
@jspec.should_receive(:execute).and_return('Passes: 3 Failures: 0')
|
27
|
+
|
28
|
+
jspec_task = JSpecTask.new(@jspec)
|
29
|
+
result = jspec_task.run(@files)
|
30
|
+
|
31
|
+
result[:state].should eql :success
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should return failure if any test fails" do
|
35
|
+
@jspec.should_receive(:execute).and_return('Passes: 2 Failures: 1')
|
36
|
+
|
37
|
+
jspec_task = JSpecTask.new(@jspec)
|
38
|
+
result = jspec_task.run(@files)
|
39
|
+
|
40
|
+
result[:state].should eql :failure
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: karl-loris
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Karl O'Keeffe
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-18 00:00:00 -07:00
|
13
13
|
default_executable: loris
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -32,7 +32,17 @@ dependencies:
|
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.0.3
|
34
34
|
version:
|
35
|
-
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: extensions
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.6.0
|
44
|
+
version:
|
45
|
+
description: Automatically run javascript unit tests
|
36
46
|
email: loris@monket.net
|
37
47
|
executables:
|
38
48
|
- loris
|
@@ -41,33 +51,33 @@ extensions: []
|
|
41
51
|
extra_rdoc_files:
|
42
52
|
- README.rdoc
|
43
53
|
files:
|
44
|
-
- .autotest
|
45
54
|
- .gitignore
|
46
55
|
- README.rdoc
|
47
56
|
- Rakefile
|
48
57
|
- TODO
|
49
58
|
- VERSION
|
50
|
-
- autotest/discover.rb
|
51
59
|
- bin/loris
|
52
60
|
- cucumber.yml
|
53
61
|
- examples/self_test/jsl.conf
|
54
62
|
- examples/self_test/spec/spec.rhino.js
|
63
|
+
- features/javascript_lint.feature
|
55
64
|
- features/run.feature
|
56
65
|
- features/step_definitons/all.rb
|
57
66
|
- features/support/env.rb
|
58
67
|
- lib/JsTestDriver-1.0b.jar
|
59
68
|
- lib/always_continuer.rb
|
60
|
-
- lib/extension_filter.rb
|
61
69
|
- lib/file_actioner.rb
|
62
|
-
- lib/file_filter.rb
|
63
70
|
- lib/file_finder.rb
|
71
|
+
- lib/filters/ends_with_filter.rb
|
72
|
+
- lib/filters/extension_filter.rb
|
73
|
+
- lib/filters/file_filter.rb
|
74
|
+
- lib/filters/modified_filter.rb
|
64
75
|
- lib/icons/error.png
|
65
76
|
- lib/icons/failure.png
|
66
77
|
- lib/icons/info.png
|
67
78
|
- lib/icons/success.png
|
68
79
|
- lib/icons/warning.png
|
69
80
|
- lib/loris.rb
|
70
|
-
- lib/modified_filter.rb
|
71
81
|
- lib/outputs/growl_output.rb
|
72
82
|
- lib/outputs/output_collection.rb
|
73
83
|
- lib/outputs/shell_output.rb
|
@@ -76,25 +86,31 @@ files:
|
|
76
86
|
- lib/poller.rb
|
77
87
|
- lib/sleep_waiter.rb
|
78
88
|
- lib/task_manager.rb
|
79
|
-
- lib/tasks/javascript_lint_runner.rb
|
80
|
-
- lib/tasks/javascript_lint_task.rb
|
81
|
-
- lib/tasks/js_test_driver_runner.rb
|
82
|
-
- lib/tasks/js_test_driver_task.rb
|
83
|
-
- lib/tasks/jspec_runner.rb
|
84
|
-
- lib/tasks/jspec_task.rb
|
89
|
+
- lib/tasks/javascript_lint/javascript_lint_runner.rb
|
90
|
+
- lib/tasks/javascript_lint/javascript_lint_task.rb
|
91
|
+
- lib/tasks/js_test_driver/js_test_driver_runner.rb
|
92
|
+
- lib/tasks/js_test_driver/js_test_driver_task.rb
|
93
|
+
- lib/tasks/jspec/jspec_runner.rb
|
94
|
+
- lib/tasks/jspec/jspec_task.rb
|
85
95
|
- lib/tasks/list_task.rb
|
96
|
+
- lib/tasks/rspec/rspec_runner.rb
|
97
|
+
- lib/tasks/rspec/rspec_task.rb
|
86
98
|
- loris.gemspec
|
87
99
|
- loris.tmproj
|
88
100
|
- spec/file_actioner_spec.rb
|
89
|
-
- spec/file_filter_spec.rb
|
90
101
|
- spec/file_finder_spec.rb
|
102
|
+
- spec/filters/ends_with_filter_spec.rb
|
103
|
+
- spec/filters/file_filter_spec.rb
|
104
|
+
- spec/filters/modified_filter_spec.rb
|
91
105
|
- spec/growl_output_spec.rb
|
92
|
-
- spec/jspec_task_spec.rb
|
93
106
|
- spec/list_task_spec.rb
|
94
|
-
- spec/modified_filter_spec.rb
|
95
107
|
- spec/poller_spec.rb
|
96
108
|
- spec/shell_output_spec.rb
|
97
109
|
- spec/task_manager_spec.rb
|
110
|
+
- spec/tasks/javascript_lint/javascript_lint_runner_spec.rb
|
111
|
+
- spec/tasks/js_test_driver/js_test_driver_runner_spec.rb
|
112
|
+
- spec/tasks/jspec/jspec_runner_spec.rb
|
113
|
+
- spec/tasks/jspec/jspec_task_spec.rb
|
98
114
|
has_rdoc: false
|
99
115
|
homepage: http://github.com/karl/loris
|
100
116
|
licenses:
|
@@ -121,15 +137,19 @@ rubyforge_project:
|
|
121
137
|
rubygems_version: 1.3.5
|
122
138
|
signing_key:
|
123
139
|
specification_version: 3
|
124
|
-
summary:
|
140
|
+
summary: Automatically run javascript unit tests
|
125
141
|
test_files:
|
126
142
|
- spec/file_actioner_spec.rb
|
127
|
-
- spec/file_filter_spec.rb
|
128
143
|
- spec/file_finder_spec.rb
|
144
|
+
- spec/filters/ends_with_filter_spec.rb
|
145
|
+
- spec/filters/file_filter_spec.rb
|
146
|
+
- spec/filters/modified_filter_spec.rb
|
129
147
|
- spec/growl_output_spec.rb
|
130
|
-
- spec/jspec_task_spec.rb
|
131
148
|
- spec/list_task_spec.rb
|
132
|
-
- spec/modified_filter_spec.rb
|
133
149
|
- spec/poller_spec.rb
|
134
150
|
- spec/shell_output_spec.rb
|
135
151
|
- spec/task_manager_spec.rb
|
152
|
+
- spec/tasks/javascript_lint/javascript_lint_runner_spec.rb
|
153
|
+
- spec/tasks/js_test_driver/js_test_driver_runner_spec.rb
|
154
|
+
- spec/tasks/jspec/jspec_runner_spec.rb
|
155
|
+
- spec/tasks/jspec/jspec_task_spec.rb
|