jasmine 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +29 -13
- data/bin/jasmine +3 -3
- data/generators/jasmine/jasmine_generator.rb +2 -2
- data/generators/jasmine/templates/lib/tasks/jasmine.rake +1 -1
- data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml +20 -0
- data/generators/jasmine/templates/spec/javascripts/support/jasmine.yml +20 -0
- data/generators/jasmine/templates/spec/javascripts/support/{jasmine_spec.rb → jasmine_runner.rb} +0 -0
- data/jasmine/contrib/ruby/jasmine_spec_builder.rb +2 -2
- data/jasmine/lib/jasmine-0.10.0.js +1 -1
- data/jasmine/lib/jasmine.css +1 -1
- data/spec/config_spec.rb +26 -15
- metadata +5 -5
- data/generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yaml +0 -10
- data/generators/jasmine/templates/spec/javascripts/support/jasmine.yaml +0 -10
data/README.markdown
CHANGED
@@ -1,21 +1,37 @@
|
|
1
1
|
jasmine-ruby
|
2
2
|
============
|
3
3
|
|
4
|
-
|
5
|
-
cd jasmine-ruby
|
6
|
-
rake jeweler:build
|
7
|
-
rake jeweler:install
|
8
|
-
cd ..
|
9
|
-
mkdir test-jasmine
|
10
|
-
cd test-jasmine
|
11
|
-
jasmine init
|
12
|
-
rake jasmine
|
4
|
+
Jasmine Ruby dynamically serves HTML suites for [Jasmine](http://github.com/pivotal/jasmine)
|
13
5
|
|
14
|
-
|
6
|
+
To use:
|
15
7
|
|
16
|
-
|
8
|
+
`(sudo) gem install jasmine`
|
17
9
|
|
18
|
-
|
10
|
+
Post-installation:
|
19
11
|
|
20
|
-
|
12
|
+
For Rails support, use
|
21
13
|
|
14
|
+
`script/generate jasmine`
|
15
|
+
|
16
|
+
For other projects, use
|
17
|
+
|
18
|
+
`jasmine init`
|
19
|
+
|
20
|
+
After initializing a project, you may
|
21
|
+
|
22
|
+
`rake jasmine`
|
23
|
+
|
24
|
+
to set up a server. Opening localhost:8888 in a web browser will now run your jasmine specs.
|
25
|
+
|
26
|
+
You may also
|
27
|
+
|
28
|
+
`rake jasmine:ci`
|
29
|
+
|
30
|
+
which will run your Jasmine suites using selenium and rspec. This task is suitable for running in continuous integration environments.
|
31
|
+
|
32
|
+
Simple Configuration:
|
33
|
+
|
34
|
+
Customize `spec/javascripts/support/jasmine.yaml` to enumerate the source files, stylesheets, and spec files you would like the Jasmine runner to include.
|
35
|
+
You may use dir glob strings.
|
36
|
+
|
37
|
+
It is also possible to add overrides into the `spec/javascripts/support/jasmine_config.rb` file directly if you require further customization.
|
data/bin/jasmine
CHANGED
@@ -32,14 +32,14 @@ if ARGV[0] == 'init'
|
|
32
32
|
copy_unless_exists('spec/javascripts/SpecHelper.js')
|
33
33
|
copy_unless_exists('spec/javascripts/ExampleSpec.js')
|
34
34
|
copy_unless_exists('spec/javascripts/support/jasmine_config.rb')
|
35
|
-
copy_unless_exists('spec/javascripts/support/
|
35
|
+
copy_unless_exists('spec/javascripts/support/jasmine_runner.rb')
|
36
36
|
|
37
37
|
rails_tasks_dir = dest_path('lib/tasks')
|
38
38
|
if File.exist?(rails_tasks_dir)
|
39
39
|
copy_unless_exists('lib/tasks/jasmine.rake')
|
40
|
-
copy_unless_exists('spec/javascripts/support/jasmine-rails.
|
40
|
+
copy_unless_exists('spec/javascripts/support/jasmine-rails.yml', 'spec/javascripts/support/jasmine.yml')
|
41
41
|
else
|
42
|
-
copy_unless_exists('spec/javascripts/support/jasmine.
|
42
|
+
copy_unless_exists('spec/javascripts/support/jasmine.yml')
|
43
43
|
write_mode = 'w'
|
44
44
|
if File.exist?(dest_path('Rakefile'))
|
45
45
|
load dest_path('Rakefile')
|
@@ -8,8 +8,8 @@ class JasmineGenerator < Rails::Generator::Base
|
|
8
8
|
|
9
9
|
m.directory "spec/javascripts/support"
|
10
10
|
m.file "spec/javascripts/support/jasmine_config.rb", "spec/javascripts/support/jasmine_config.rb"
|
11
|
-
m.file "spec/javascripts/support/
|
12
|
-
m.file "spec/javascripts/support/jasmine-rails.
|
11
|
+
m.file "spec/javascripts/support/jasmine_runner.rb", "spec/javascripts/support/jasmine_runner.rb"
|
12
|
+
m.file "spec/javascripts/support/jasmine-rails.yml", "spec/javascripts/support/jasmine.yml"
|
13
13
|
|
14
14
|
m.directory "lib/tasks"
|
15
15
|
m.file "lib/tasks/jasmine.rake", "lib/tasks/jasmine.rake"
|
@@ -7,7 +7,7 @@ namespace :jasmine do
|
|
7
7
|
Spec::Rake::SpecTask.new(:ci) do |t|
|
8
8
|
t.spec_opts = ["--color", "--format", "specdoc"]
|
9
9
|
t.verbose = true
|
10
|
-
t.spec_files = ['spec/javascripts/support/
|
10
|
+
t.spec_files = ['spec/javascripts/support/jasmine_runner.rb']
|
11
11
|
end
|
12
12
|
task :server do
|
13
13
|
require 'spec/javascripts/support/jasmine_config'
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
2
|
+
src_files:
|
3
|
+
- javascripts/prototype.js
|
4
|
+
- javascripts/effects.js
|
5
|
+
- javascripts/controls.js
|
6
|
+
- javascripts/dragdrop.js
|
7
|
+
- javascripts/application.js
|
8
|
+
|
9
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
10
|
+
stylesheets:
|
11
|
+
- stylesheets/**/*.css
|
12
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
13
|
+
spec_files:
|
14
|
+
- **/*.js
|
15
|
+
|
16
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
17
|
+
src_dir: public
|
18
|
+
|
19
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
20
|
+
spec_dir: spec/javascripts
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Return an array of filepaths relative to src_dir to include before jasmine specs.
|
2
|
+
#src_files:
|
3
|
+
# - lib/source1.js
|
4
|
+
# - lib/source2.js
|
5
|
+
# - dist/**/*.js
|
6
|
+
|
7
|
+
# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
|
8
|
+
#stylesheets:
|
9
|
+
# - css/style.css
|
10
|
+
# - stylesheets/*.css
|
11
|
+
|
12
|
+
# Return an array of filepaths relative to spec_dir to include before jasmine specs.
|
13
|
+
#spec_files:
|
14
|
+
# - **/*.js
|
15
|
+
|
16
|
+
# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
|
17
|
+
#src_dir:
|
18
|
+
|
19
|
+
# Spec directory path. Your spec_files must be returned relative to this path.
|
20
|
+
#spec_dir: spec/javascripts
|
data/generators/jasmine/templates/spec/javascripts/support/{jasmine_spec.rb → jasmine_runner.rb}
RENAMED
File without changes
|
@@ -58,7 +58,7 @@ module Jasmine
|
|
58
58
|
sleep 0.1
|
59
59
|
end
|
60
60
|
|
61
|
-
@suites = eval_js(
|
61
|
+
@suites = eval_js("var result = jsApiReporter.suites(); if (window.Prototype && result && result.toJSON) { result.toJSON()} else { JSON.stringify(result) }")
|
62
62
|
end
|
63
63
|
|
64
64
|
def results_for(spec_id)
|
@@ -69,7 +69,7 @@ module Jasmine
|
|
69
69
|
def load_results
|
70
70
|
@spec_results = {}
|
71
71
|
@spec_ids.each_slice(50) do |slice|
|
72
|
-
@spec_results.merge!(eval_js("
|
72
|
+
@spec_results.merge!(eval_js("var result = jsApiReporter.resultsForSpecs(#{JSON.generate(slice)}); if (window.Prototype && result && result.toJSON) { result.toJSON()} else { JSON.stringify(result) }"))
|
73
73
|
end
|
74
74
|
@spec_results
|
75
75
|
end
|
data/jasmine/lib/jasmine.css
CHANGED
data/spec/config_spec.rb
CHANGED
@@ -4,11 +4,14 @@ describe Jasmine::Config do
|
|
4
4
|
before(:each) do
|
5
5
|
@template_dir = File.expand_path(File.join(File.dirname(__FILE__), "../generators/jasmine/templates"))
|
6
6
|
@config = Jasmine::Config.new
|
7
|
-
@config.stub!(:src_dir).and_return(File.join(@template_dir, "public"))
|
8
|
-
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec"))
|
9
7
|
end
|
10
8
|
|
11
|
-
describe "
|
9
|
+
describe "configuration" do
|
10
|
+
before(:each) do
|
11
|
+
@config.stub!(:src_dir).and_return(File.join(@template_dir, "public"))
|
12
|
+
@config.stub!(:spec_dir).and_return(File.join(@template_dir, "spec"))
|
13
|
+
end
|
14
|
+
|
12
15
|
it "if sources.yaml not found" do
|
13
16
|
File.stub!(:exist?).and_return(false)
|
14
17
|
@config.src_files.should == []
|
@@ -20,7 +23,7 @@ describe Jasmine::Config do
|
|
20
23
|
}
|
21
24
|
end
|
22
25
|
|
23
|
-
it "if
|
26
|
+
it "if jasmine.yml is empty" do
|
24
27
|
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yaml'))
|
25
28
|
YAML.stub!(:load).and_return(false)
|
26
29
|
@config.src_files.should == []
|
@@ -32,8 +35,8 @@ describe Jasmine::Config do
|
|
32
35
|
}
|
33
36
|
end
|
34
37
|
|
35
|
-
it "using default jasmine.
|
36
|
-
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.
|
38
|
+
it "using default jasmine.yml" do
|
39
|
+
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
37
40
|
@config.src_files.should == []
|
38
41
|
@config.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
|
39
42
|
@config.mappings.should == {
|
@@ -43,7 +46,7 @@ describe Jasmine::Config do
|
|
43
46
|
end
|
44
47
|
|
45
48
|
it "simple_config stylesheets" do
|
46
|
-
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.
|
49
|
+
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
47
50
|
YAML.stub!(:load).and_return({'stylesheets' => ['foo.css', 'bar.css']})
|
48
51
|
Dir.stub!(:glob).and_return do |glob_string|
|
49
52
|
glob_string
|
@@ -60,7 +63,7 @@ describe Jasmine::Config do
|
|
60
63
|
original_glob.call(glob_string)
|
61
64
|
end
|
62
65
|
end
|
63
|
-
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine-rails.
|
66
|
+
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine-rails.yml'))
|
64
67
|
@config.spec_files.should == ['javascripts/ExampleSpec.js', 'javascripts/SpecHelper.js']
|
65
68
|
@config.src_files.should == ['javascripts/prototype.js',
|
66
69
|
'javascripts/effects.js',
|
@@ -77,6 +80,21 @@ describe Jasmine::Config do
|
|
77
80
|
'/__spec__/javascripts/SpecHelper.js',
|
78
81
|
]
|
79
82
|
end
|
83
|
+
|
84
|
+
it "should provide a list of all spec files with full paths" do
|
85
|
+
@config.spec_files_full_paths.should == [
|
86
|
+
File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
|
87
|
+
File.join(@template_dir, 'spec/javascripts/SpecHelper.js')
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
|
93
|
+
it "src_dir uses root when src dir is blank" do
|
94
|
+
@config.stub!(:project_root).and_return('some_project_root')
|
95
|
+
@config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yml'))
|
96
|
+
YAML.stub!(:load).and_return({'src_dir' => nil})
|
97
|
+
@config.src_dir.should == 'some_project_root'
|
80
98
|
end
|
81
99
|
|
82
100
|
|
@@ -87,11 +105,4 @@ describe Jasmine::Config do
|
|
87
105
|
}
|
88
106
|
end
|
89
107
|
|
90
|
-
it "should provide a list of all spec files with full paths" do
|
91
|
-
@config.spec_files_full_paths.should == [
|
92
|
-
File.join(@template_dir, 'spec/javascripts/ExampleSpec.js'),
|
93
|
-
File.join(@template_dir, 'spec/javascripts/SpecHelper.js')
|
94
|
-
]
|
95
|
-
end
|
96
|
-
|
97
108
|
end
|
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.4.
|
4
|
+
version: 0.4.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-01-
|
13
|
+
date: 2010-01-27 00:00:00 -08:00
|
14
14
|
default_executable: jasmine
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -87,10 +87,10 @@ files:
|
|
87
87
|
- generators/jasmine/templates/lib/tasks/jasmine.rake
|
88
88
|
- generators/jasmine/templates/spec/javascripts/ExampleSpec.js
|
89
89
|
- generators/jasmine/templates/spec/javascripts/SpecHelper.js
|
90
|
-
- generators/jasmine/templates/spec/javascripts/support/jasmine-rails.
|
91
|
-
- generators/jasmine/templates/spec/javascripts/support/jasmine.
|
90
|
+
- generators/jasmine/templates/spec/javascripts/support/jasmine-rails.yml
|
91
|
+
- generators/jasmine/templates/spec/javascripts/support/jasmine.yml
|
92
92
|
- generators/jasmine/templates/spec/javascripts/support/jasmine_config.rb
|
93
|
-
- generators/jasmine/templates/spec/javascripts/support/
|
93
|
+
- generators/jasmine/templates/spec/javascripts/support/jasmine_runner.rb
|
94
94
|
- jasmine/contrib/ruby/jasmine_runner.rb
|
95
95
|
- jasmine/contrib/ruby/jasmine_spec_builder.rb
|
96
96
|
- jasmine/contrib/ruby/run.html
|