jasmine 0.4.1 → 0.4.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.
@@ -1,21 +1,37 @@
1
1
  jasmine-ruby
2
2
  ============
3
3
 
4
- git clone git://github.com/ragaskar/jasmine-ruby.git
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
- then
6
+ To use:
15
7
 
16
- http://localhost:8888
8
+ `(sudo) gem install jasmine`
17
9
 
18
- and go!
10
+ Post-installation:
19
11
 
20
- After a few more touch-ups, I'll update the gemcutter.org gem ...
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.
@@ -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/jasmine_spec.rb')
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.yaml', 'spec/javascripts/support/jasmine.yaml')
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.yaml')
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/jasmine_spec.rb", "spec/javascripts/support/jasmine_spec.rb"
12
- m.file "spec/javascripts/support/jasmine-rails.yaml", "spec/javascripts/support/jasmine.yaml"
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/jasmine_spec.rb']
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
@@ -58,7 +58,7 @@ module Jasmine
58
58
  sleep 0.1
59
59
  end
60
60
 
61
- @suites = eval_js('JSON.stringify(jsApiReporter.suites())')
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("JSON.stringify(jsApiReporter.resultsForSpecs(#{JSON.generate(slice)}))"))
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
@@ -2257,5 +2257,5 @@ jasmine.version_= {
2257
2257
  "major": 0,
2258
2258
  "minor": 10,
2259
2259
  "build": 0,
2260
- "revision": 1261768736
2260
+ "revision": 1264648722
2261
2261
  };
@@ -82,5 +82,5 @@ body .run_spec {
82
82
 
83
83
  #jasmine_content {
84
84
  position:fixed;
85
- left: 100%;
85
+ right: 100%;
86
86
  }
@@ -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 "simple_config" do
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 sources.yaml is empty" do
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.yaml" do
36
- @config.stub!(:simple_config_file).and_return(File.join(@template_dir, 'spec/javascripts/support/jasmine.yaml'))
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.yaml'))
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.yaml'))
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.1
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-26 00:00:00 -08:00
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.yaml
91
- - generators/jasmine/templates/spec/javascripts/support/jasmine.yaml
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/jasmine_spec.rb
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
@@ -1,10 +0,0 @@
1
- src_files:
2
- - javascripts/prototype.js
3
- - javascripts/effects.js
4
- - javascripts/controls.js
5
- - javascripts/dragdrop.js
6
- - javascripts/application.js
7
- spec_files:
8
- - **/*.js
9
- src_dir: public
10
- spec_dir: spec/javascripts
@@ -1,10 +0,0 @@
1
- #src_files:
2
- # - lib/source1.js
3
- # - lib/source2.js
4
- # - dist/**/*.js
5
- #stylesheets:
6
- # - css/style.css
7
- #spec_files:
8
- # -
9
- #src_dir:
10
- #spec_dir: spec/javascripts