jasmine 0.10.2.1 → 0.10.2.2
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/bin/jasmine +2 -2
- data/generators/jasmine/jasmine_generator.rb +3 -2
- data/generators/jasmine/templates/lib/tasks/jasmine.rake +2 -1
- data/generators/jasmine/templates/spec/javascripts/{SpecHelper.js → helpers/SpecHelper.js} +0 -0
- data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +12 -7
- data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +5 -1
- data/generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb +3 -1
- data/lib/jasmine/config.rb +12 -7
- data/lib/jasmine/server.rb +1 -1
- data/spec/config_spec.rb +70 -60
- metadata +3 -4
- data/generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb +0 -61
data/bin/jasmine
CHANGED
@@ -28,10 +28,10 @@ if ARGV[0] == 'init'
|
|
28
28
|
require 'ftools'
|
29
29
|
File.makedirs('spec/javascripts')
|
30
30
|
File.makedirs('spec/javascripts/support')
|
31
|
+
File.makedirs('spec/javascripts/helpers')
|
31
32
|
|
32
|
-
copy_unless_exists('spec/javascripts/SpecHelper.js')
|
33
|
+
copy_unless_exists('spec/javascripts/helpers/SpecHelper.js')
|
33
34
|
copy_unless_exists('spec/javascripts/ExampleSpec.js')
|
34
|
-
copy_unless_exists('spec/javascripts/support/jasmine_config.rb')
|
35
35
|
copy_unless_exists('spec/javascripts/support/jasmine_runner.rb')
|
36
36
|
|
37
37
|
rails_tasks_dir = dest_path('lib/tasks')
|
@@ -3,11 +3,12 @@ class JasmineGenerator < Rails::Generator::Base
|
|
3
3
|
record do |m|
|
4
4
|
|
5
5
|
m.directory "spec/javascripts"
|
6
|
-
m.file "spec/javascripts/SpecHelper.js", "spec/javascripts/SpecHelper.js"
|
7
6
|
m.file "spec/javascripts/ExampleSpec.js", "spec/javascripts/ExampleSpec.js"
|
8
7
|
|
8
|
+
m.directory "spec/javascripts/helpers"
|
9
|
+
m.file "spec/javascripts/helpers/SpecHelper.js", "spec/javascripts/helpers/SpecHelper.js"
|
10
|
+
|
9
11
|
m.directory "spec/javascripts/support"
|
10
|
-
m.file "spec/javascripts/support/jasmine_config.rb", "spec/javascripts/support/jasmine_config.rb"
|
11
12
|
m.file "spec/javascripts/support/jasmine_runner.rb", "spec/javascripts/support/jasmine_runner.rb"
|
12
13
|
m.file "spec/javascripts/support/jasmine-rails.yml", "spec/javascripts/support/jasmine.yml"
|
13
14
|
|
@@ -10,7 +10,8 @@ namespace :jasmine do
|
|
10
10
|
t.spec_files = ['spec/javascripts/support/jasmine_runner.rb']
|
11
11
|
end
|
12
12
|
task :server do
|
13
|
-
|
13
|
+
jasmine_config_overrides = 'spec/javascripts/support/jasmine_config'
|
14
|
+
require jasmine_config_overrides if File.exists?(jasmine_config_overrides)
|
14
15
|
|
15
16
|
puts "your tests are here:"
|
16
17
|
puts " http://localhost:8888/run.html"
|
File without changes
|
@@ -1,20 +1,25 @@
|
|
1
1
|
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
2
2
|
src_files:
|
3
|
-
- javascripts/prototype.js
|
4
|
-
- javascripts/effects.js
|
5
|
-
- javascripts/controls.js
|
6
|
-
- javascripts/dragdrop.js
|
7
|
-
- javascripts/application.js
|
3
|
+
- public/javascripts/prototype.js
|
4
|
+
- public/javascripts/effects.js
|
5
|
+
- public/javascripts/controls.js
|
6
|
+
- public/javascripts/dragdrop.js
|
7
|
+
- public/javascripts/application.js
|
8
8
|
|
9
9
|
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
10
10
|
stylesheets:
|
11
11
|
- stylesheets/**/*.css
|
12
|
+
|
12
13
|
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
14
|
+
helpers:
|
15
|
+
- helpers/**/*.js
|
16
|
+
|
17
|
+
# Return an array of filepaths relative to spec_dir to include
|
13
18
|
spec_files:
|
14
|
-
-
|
19
|
+
- **/*[sS]pec.js
|
15
20
|
|
16
21
|
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
17
|
-
src_dir:
|
22
|
+
src_dir:
|
18
23
|
|
19
24
|
# Spec directory path. Your spec_files must be returned relative to this path.
|
20
25
|
spec_dir: spec/javascripts
|
@@ -10,8 +10,12 @@
|
|
10
10
|
# - stylesheets/*.css
|
11
11
|
|
12
12
|
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
13
|
+
#helpers:
|
14
|
+
# - helpers/**/*.js
|
15
|
+
|
16
|
+
# Return an array of filepaths relative to spec_dir to include.
|
13
17
|
#spec_files:
|
14
|
-
# -
|
18
|
+
# - **/*[sS]pec.js
|
15
19
|
|
16
20
|
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
17
21
|
#src_dir:
|
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require
|
2
|
+
require 'jasmine'
|
3
|
+
jasmine_config_overrides = File.expand_path(File.join(File.dirname(__FILE__), 'jasmine_config'))
|
4
|
+
require jasmine_config_overrides if File.exists?(jasmine_config_overrides)
|
3
5
|
|
4
6
|
jasmine_config = Jasmine::Config.new
|
5
7
|
spec_builder = Jasmine::SpecBuilder.new(jasmine_config)
|
data/lib/jasmine/config.rb
CHANGED
@@ -109,12 +109,9 @@ module Jasmine
|
|
109
109
|
}
|
110
110
|
end
|
111
111
|
|
112
|
-
def js_files
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
def focused_files(spec_filter)
|
117
|
-
src_files.collect {|f| "/" + f } + match_files(spec_dir, spec_filter).collect {|f| File.join(spec_path, f) }
|
112
|
+
def js_files(spec_filter = nil)
|
113
|
+
spec_files_to_include = spec_filter.nil? ? spec_files : match_files(spec_dir, spec_filter)
|
114
|
+
src_files.collect {|f| "/" + f } + helpers.collect {|f| File.join(spec_path, f) } + spec_files_to_include.collect {|f| File.join(spec_path, f) }
|
118
115
|
end
|
119
116
|
|
120
117
|
def css_files
|
@@ -149,6 +146,14 @@ module Jasmine
|
|
149
146
|
end
|
150
147
|
end
|
151
148
|
|
149
|
+
def helpers
|
150
|
+
files = match_files(spec_dir, "helpers/**/*.js")
|
151
|
+
if simple_config['helpers']
|
152
|
+
files = match_files(spec_dir, simple_config['helpers'])
|
153
|
+
end
|
154
|
+
files
|
155
|
+
end
|
156
|
+
|
152
157
|
def src_files
|
153
158
|
files = []
|
154
159
|
if simple_config['src_files']
|
@@ -158,7 +163,7 @@ module Jasmine
|
|
158
163
|
end
|
159
164
|
|
160
165
|
def spec_files
|
161
|
-
files = match_files(spec_dir, "
|
166
|
+
files = match_files(spec_dir, "**/*[sS]pec.js")
|
162
167
|
if simple_config['spec_files']
|
163
168
|
files = match_files(spec_dir, simple_config['spec_files'])
|
164
169
|
end
|
data/lib/jasmine/server.rb
CHANGED
@@ -29,7 +29,7 @@ module Jasmine
|
|
29
29
|
def run(focused_suite = nil)
|
30
30
|
jasmine_files = @jasmine_files
|
31
31
|
css_files = @jasmine_stylesheets + (@config.css_files || [])
|
32
|
-
js_files =
|
32
|
+
js_files = @config.js_files(focused_suite)
|
33
33
|
body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html.erb"))).result(binding)
|
34
34
|
[
|
35
35
|
200,
|
data/spec/config_spec.rb
CHANGED
@@ -35,46 +35,59 @@ describe Jasmine::Config do
|
|
35
35
|
|
36
36
|
describe "simple_config" do
|
37
37
|
before(:each) do
|
38
|
-
@config.stub!(:src_dir).and_return(File.join(@template_dir
|
39
|
-
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec"))
|
38
|
+
@config.stub!(:src_dir).and_return(File.join(@template_dir))
|
39
|
+
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec/javascripts"))
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
42
|
+
shared_examples_for "simple_config defaults" do
|
43
|
+
it "should return the correct files and mappings" do
|
44
|
+
@config.src_files.should == []
|
45
|
+
@config.stylesheets.should == []
|
46
|
+
@config.spec_files.should == ['ExampleSpec.js']
|
47
|
+
@config.helpers.should == ['helpers/SpecHelper.js']
|
48
|
+
@config.js_files.should == [
|
49
|
+
'/__spec__/helpers/SpecHelper.js',
|
50
|
+
'/__spec__/ExampleSpec.js',
|
51
|
+
]
|
52
|
+
@config.js_files("ExampleSpec.js").should ==
|
53
|
+
['/__spec__/helpers/SpecHelper.js',
|
54
|
+
'/__spec__/ExampleSpec.js']
|
55
|
+
@config.mappings.should == {
|
56
|
+
'/__root__' => @config.project_root,
|
57
|
+
'/__spec__' => @config.spec_dir
|
58
|
+
}
|
59
|
+
@config.spec_files_full_paths.should == [
|
60
|
+
File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
|
61
|
+
]
|
62
|
+
end
|
52
63
|
end
|
53
64
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
@config.focused_files("javascripts/ExampleSpec.js").should == ['/__spec__/javascripts/ExampleSpec.js']
|
61
|
-
@config.mappings.should == {
|
62
|
-
'/__root__' => @config.project_root,
|
63
|
-
'/__spec__' => @config.spec_dir
|
64
|
-
}
|
65
|
+
|
66
|
+
describe "if sources.yaml not found" do
|
67
|
+
before(:each) do
|
68
|
+
File.stub!(:exist?).and_return(false)
|
69
|
+
end
|
70
|
+
it_should_behave_like "simple_config defaults"
|
65
71
|
end
|
66
72
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
73
|
+
describe "if jasmine.yml is empty" do
|
74
|
+
before(:each) do
|
75
|
+
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
76
|
+
YAML.stub!(:load).and_return(false)
|
77
|
+
end
|
78
|
+
it_should_behave_like "simple_config defaults"
|
79
|
+
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "using default jasmine.yml" do
|
83
|
+
before(:each) do
|
84
|
+
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
85
|
+
end
|
86
|
+
it_should_behave_like "simple_config defaults"
|
87
|
+
|
76
88
|
end
|
77
89
|
|
90
|
+
|
78
91
|
it "simple_config stylesheets" do
|
79
92
|
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
80
93
|
YAML.stub!(:load).and_return({'stylesheets' => ['foo.css', 'bar.css']})
|
@@ -84,7 +97,9 @@ describe Jasmine::Config do
|
|
84
97
|
@config.stylesheets.should == ['foo.css', 'bar.css']
|
85
98
|
end
|
86
99
|
|
100
|
+
|
87
101
|
it "using rails jasmine.yml" do
|
102
|
+
|
88
103
|
original_glob = Dir.method(:glob)
|
89
104
|
Dir.stub!(:glob).and_return do |glob_string|
|
90
105
|
if glob_string =~ /public/
|
@@ -94,39 +109,34 @@ describe Jasmine::Config do
|
|
94
109
|
end
|
95
110
|
end
|
96
111
|
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine-rails.yml'))
|
97
|
-
@config.spec_files.should == ['
|
98
|
-
@config.
|
99
|
-
|
100
|
-
'javascripts/
|
101
|
-
'javascripts/
|
102
|
-
'javascripts/
|
112
|
+
@config.spec_files.should == ['ExampleSpec.js']
|
113
|
+
@config.helpers.should == ['helpers/SpecHelper.js']
|
114
|
+
@config.src_files.should == ['public/javascripts/prototype.js',
|
115
|
+
'public/javascripts/effects.js',
|
116
|
+
'public/javascripts/controls.js',
|
117
|
+
'public/javascripts/dragdrop.js',
|
118
|
+
'public/javascripts/application.js']
|
103
119
|
@config.js_files.should == [
|
104
|
-
'/javascripts/prototype.js',
|
105
|
-
'/javascripts/effects.js',
|
106
|
-
'/javascripts/controls.js',
|
107
|
-
'/javascripts/dragdrop.js',
|
108
|
-
'/javascripts/application.js',
|
109
|
-
'/__spec__/
|
110
|
-
'/__spec__/
|
120
|
+
'/public/javascripts/prototype.js',
|
121
|
+
'/public/javascripts/effects.js',
|
122
|
+
'/public/javascripts/controls.js',
|
123
|
+
'/public/javascripts/dragdrop.js',
|
124
|
+
'/public/javascripts/application.js',
|
125
|
+
'/__spec__/helpers/SpecHelper.js',
|
126
|
+
'/__spec__/ExampleSpec.js',
|
111
127
|
]
|
112
|
-
@config.
|
113
|
-
'/javascripts/prototype.js',
|
114
|
-
'/javascripts/effects.js',
|
115
|
-
'/javascripts/controls.js',
|
116
|
-
'/javascripts/dragdrop.js',
|
117
|
-
'/javascripts/application.js',
|
118
|
-
'/__spec__/
|
128
|
+
@config.js_files("ExampleSpec.js").should == [
|
129
|
+
'/public/javascripts/prototype.js',
|
130
|
+
'/public/javascripts/effects.js',
|
131
|
+
'/public/javascripts/controls.js',
|
132
|
+
'/public/javascripts/dragdrop.js',
|
133
|
+
'/public/javascripts/application.js',
|
134
|
+
'/__spec__/helpers/SpecHelper.js',
|
135
|
+
'/__spec__/ExampleSpec.js'
|
119
136
|
]
|
120
137
|
|
121
138
|
end
|
122
139
|
|
123
|
-
it "should provide a list of all spec files with full paths" do
|
124
|
-
@config.spec_files_full_paths.should == [
|
125
|
-
File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
|
126
|
-
File.join(@template_dir, 'spec/javascripts/SpecHelper.js')
|
127
|
-
]
|
128
|
-
end
|
129
|
-
|
130
140
|
end
|
131
141
|
|
132
142
|
end
|
@@ -154,7 +164,7 @@ describe Jasmine::Config do
|
|
154
164
|
end
|
155
165
|
|
156
166
|
describe "#start_selenium_server" do
|
157
|
-
|
167
|
+
it "should use an existing selenium server if SELENIUM_SERVER_PORT is set" do
|
158
168
|
config = Jasmine::Config.new
|
159
169
|
ENV.stub!(:[], "SELENIUM_SERVER_PORT").and_return(1234)
|
160
170
|
Jasmine.should_receive(:wait_for_listener).with(1234, "selenium server")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.2.
|
4
|
+
version: 0.10.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Agaskar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-03-
|
13
|
+
date: 2010-03-20 00:00:00 -07:00
|
14
14
|
default_executable: jasmine
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -86,10 +86,9 @@ files:
|
|
86
86
|
- generators/jasmine/templates/INSTALL
|
87
87
|
- generators/jasmine/templates/lib/tasks/jasmine.rake
|
88
88
|
- generators/jasmine/templates/spec/javascripts/ExampleSpec.js
|
89
|
-
- generators/jasmine/templates/spec/javascripts/SpecHelper.js
|
89
|
+
- generators/jasmine/templates/spec/javascripts/helpers/SpecHelper.js
|
90
90
|
- generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml
|
91
91
|
- generators/jasmine/templates/spec/javascripts/support/jasmine.yml
|
92
|
-
- generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb
|
93
92
|
- generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb
|
94
93
|
- jasmine/contrib/ruby/jasmine_runner.rb
|
95
94
|
- jasmine/contrib/ruby/jasmine_spec_builder.rb
|
@@ -1,61 +0,0 @@
|
|
1
|
-
require 'jasmine'
|
2
|
-
|
3
|
-
class Jasmine::Config
|
4
|
-
|
5
|
-
# Override these methods if necessary
|
6
|
-
|
7
|
-
# def project_root
|
8
|
-
# Dir.pwd
|
9
|
-
# end
|
10
|
-
|
11
|
-
# Path to your jasmine.yml
|
12
|
-
# def simple_config_file
|
13
|
-
# File.join(project_root, 'spec/javascripts/support/jasmine.yml')
|
14
|
-
# end
|
15
|
-
|
16
|
-
# Source directory path. Your src_files must be returned relative to this path.
|
17
|
-
# def src_dir
|
18
|
-
# if simple_config['src_dir']
|
19
|
-
# File.join(project_root, simple_config['src_dir'])
|
20
|
-
# else
|
21
|
-
# project_root
|
22
|
-
# end
|
23
|
-
# end
|
24
|
-
|
25
|
-
# Spec directory path. Your spec_files must be returned relative to this path.
|
26
|
-
# def spec_dir
|
27
|
-
# if simple_config['spec_dir']
|
28
|
-
# File.join(project_root, simple_config['spec_dir'])
|
29
|
-
# else
|
30
|
-
# File.join(project_root, 'spec/javascripts')
|
31
|
-
# end
|
32
|
-
# end
|
33
|
-
|
34
|
-
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
35
|
-
# def src_files
|
36
|
-
# files = []
|
37
|
-
# if simple_config['src_files']
|
38
|
-
# files = simple_config['src_files'].collect {|filepath| Dir.glob(filepath)}
|
39
|
-
# end
|
40
|
-
# files
|
41
|
-
# end
|
42
|
-
|
43
|
-
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
44
|
-
# def spec_files
|
45
|
-
# files = match_files(spec_dir, "**/*.js")
|
46
|
-
# if simple_config['spec_files']
|
47
|
-
# files = simple_config['spec_files'].collect {|filepath| Dir.glob(filepath)}
|
48
|
-
# end
|
49
|
-
# files
|
50
|
-
# end
|
51
|
-
|
52
|
-
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
53
|
-
# def stylesheets
|
54
|
-
# files = []
|
55
|
-
# if simple_config['stylesheets']
|
56
|
-
# files = simple_config['stylesheets'].collect {|filepath| Dir.glob(filepath)}
|
57
|
-
# end
|
58
|
-
# files
|
59
|
-
# end
|
60
|
-
|
61
|
-
end
|