jasmine 2.0.0 → 2.99.0

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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +27 -13
  3. data/Gemfile +9 -9
  4. data/HOW_TO_TEST.markdown +1 -0
  5. data/README.markdown +18 -11
  6. data/jasmine.gemspec +14 -6
  7. data/lib/generators/jasmine/examples/templates/spec/javascripts/helpers/jasmine_examples/SpecHelper.js +1 -1
  8. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine.yml +38 -5
  9. data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine_helper.rb +14 -9
  10. data/lib/jasmine/application.rb +2 -2
  11. data/lib/jasmine/asset_expander.rb +56 -8
  12. data/lib/jasmine/base.rb +5 -5
  13. data/lib/jasmine/ci_runner.rb +50 -0
  14. data/lib/jasmine/command_line_tool.rb +4 -4
  15. data/lib/jasmine/config.rb +34 -5
  16. data/lib/jasmine/configuration.rb +31 -11
  17. data/lib/jasmine/dependencies.rb +8 -37
  18. data/lib/jasmine/formatters/console.rb +69 -4
  19. data/lib/jasmine/formatters/exit_code.rb +4 -6
  20. data/lib/jasmine/formatters/multi.rb +3 -11
  21. data/lib/jasmine/path_expander.rb +5 -1
  22. data/lib/jasmine/path_mapper.rb +11 -2
  23. data/lib/jasmine/railtie.rb +1 -1
  24. data/lib/jasmine/result.rb +21 -9
  25. data/lib/jasmine/ruby_versions.rb +11 -0
  26. data/lib/jasmine/run.html.erb +1 -1
  27. data/lib/jasmine/runners/phantom_boot.js +15 -0
  28. data/lib/jasmine/runners/phantom_jasmine_run.js +39 -43
  29. data/lib/jasmine/runners/phantom_js.rb +53 -8
  30. data/lib/jasmine/server.rb +7 -10
  31. data/lib/jasmine/tasks/jasmine.rake +29 -25
  32. data/lib/jasmine/version.rb +1 -1
  33. data/lib/jasmine/yaml_config_parser.rb +28 -0
  34. data/lib/jasmine.rb +1 -1
  35. data/release_notes/v2.0.1.md +31 -0
  36. data/release_notes/v2.0.2.md +17 -0
  37. data/release_notes/v2.0.3.md +31 -0
  38. data/release_notes/v2.1.0.md +11 -0
  39. data/release_notes/v2.2.0.md +31 -0
  40. data/release_notes/v2.3.0.md +27 -0
  41. data/release_notes/v2.3.1.md +14 -0
  42. data/release_notes/v2.4.0.md +20 -0
  43. data/release_notes/v2.5.0.md +35 -0
  44. data/release_notes/v2.5.1.md +12 -0
  45. data/release_notes/v2.5.2.md +22 -0
  46. data/release_notes/v2.6.0.md +17 -0
  47. data/release_notes/v2.6.1.md +11 -0
  48. data/release_notes/v2.7.0.md +28 -0
  49. data/release_notes/v2.8.0.md +21 -0
  50. data/release_notes/v2.9.0.md +22 -0
  51. data/release_notes/v2.99.md +13 -0
  52. data/spec/application_integration_spec.rb +3 -3
  53. data/spec/application_spec.rb +27 -11
  54. data/spec/base_spec.rb +27 -6
  55. data/spec/ci_runner_spec.rb +137 -0
  56. data/spec/configuration_spec.rb +57 -23
  57. data/spec/fixture/afterall_spec.js +8 -0
  58. data/spec/fixture/console_log_spec.js +5 -0
  59. data/spec/fixture/exception_test.js +1 -0
  60. data/spec/fixture/phantomConfig.js +6 -0
  61. data/spec/fixture/viewport_spec.js +6 -0
  62. data/spec/jasmine_command_line_tool_spec.rb +46 -27
  63. data/spec/jasmine_pojs_spec.rb +73 -12
  64. data/spec/jasmine_rails_spec.rb +107 -41
  65. data/spec/lib/jasmine/formatters/console_spec.rb +124 -26
  66. data/spec/lib/jasmine/formatters/exit_code_spec.rb +34 -0
  67. data/spec/lib/jasmine/formatters/multi_spec.rb +16 -6
  68. data/spec/page_spec.rb +2 -2
  69. data/spec/path_expander_spec.rb +22 -5
  70. data/spec/path_mapper_spec.rb +14 -9
  71. data/spec/performance/phantom_js_runner_performance_spec.rb +1 -1
  72. data/spec/phantom_js_spec.rb +14 -0
  73. data/spec/rack/jasmine/runner_spec.rb +2 -2
  74. data/spec/result_spec.rb +17 -7
  75. data/spec/server_spec.rb +13 -39
  76. data/spec/spec_helper.rb +54 -6
  77. data/spec/yaml_config_parser_spec.rb +21 -21
  78. metadata +75 -36
  79. data/lib/jasmine/asset_bundle.rb +0 -68
@@ -11,14 +11,14 @@ describe Rack::Jasmine::Runner do
11
11
  let(:expected_headers) { {"Content-Type" => "text/html"} }
12
12
  let(:path) { "/" }
13
13
  it "should return a response with the passed content" do
14
- subject.should == [200, expected_headers, [content]]
14
+ expect(subject).to eq [200, expected_headers, [content]]
15
15
  end
16
16
  end
17
17
  context "PATH_INFO is not /" do
18
18
  let(:path) { "/some_foo" }
19
19
  let(:expected_headers) { {"Content-Type" => "text/plain", "X-Cascade" => "pass"} }
20
20
  it "should return a 404" do
21
- subject.should == [404, expected_headers, ["File not found: #{path}\n"]]
21
+ expect(subject).to eq [404, expected_headers, ["File not found: #{path}\n"]]
22
22
  end
23
23
  end
24
24
  end
data/spec/result_spec.rb CHANGED
@@ -5,8 +5,8 @@ describe Jasmine::Result do
5
5
  it "exposes failed expectations" do
6
6
  result = Jasmine::Result.new(failing_raw_result)
7
7
  expectation = result.failed_expectations[0]
8
- expectation.message.should == "a failure message"
9
- expectation.stack.should == "a stack trace"
8
+ expect(expectation.message).to eq "a failure message"
9
+ expect(expectation.stack).to eq "a stack trace"
10
10
  end
11
11
 
12
12
  it "exposes only the last 7 lines of the stack trace" do
@@ -15,10 +15,20 @@ describe Jasmine::Result do
15
15
 
16
16
  result = Jasmine::Result.new(raw_result)
17
17
  expectation = result.failed_expectations[0].stack
18
- expectation.should match(/1/)
19
- expectation.should match(/7/)
20
- expectation.should_not match(/8/)
21
- expectation.should_not match(/9/)
18
+ expect(expectation).to match(/1/)
19
+ expect(expectation).to match(/7/)
20
+ expect(expectation).to_not match(/8/)
21
+ expect(expectation).to_not match(/9/)
22
+ end
23
+
24
+ it "exposes the full stack trace when configured" do
25
+ stack_trace = "1\n2\n3\n4\n5\n6\n7\n8\n9"
26
+ raw_result = failing_raw_result
27
+ raw_result["failedExpectations"][0]["stack"] = stack_trace
28
+
29
+ result = Jasmine::Result.new(raw_result.merge!("show_full_stack_trace" => true))
30
+ expectation = result.failed_expectations[0].stack
31
+ expect(expectation).to eq stack_trace
22
32
  end
23
33
 
24
34
  it "handles failed specs with no stack trace" do
@@ -26,7 +36,7 @@ describe Jasmine::Result do
26
36
 
27
37
  result = Jasmine::Result.new(raw_result)
28
38
  expectation = result.failed_expectations[0].stack
29
- expectation.should match(/No stack/)
39
+ expect(expectation).to match(/No stack/)
30
40
  end
31
41
 
32
42
  end
data/spec/server_spec.rb CHANGED
@@ -1,48 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jasmine::Server do
4
- describe "rack ~> 1.0" do
5
- before do
6
- Jasmine::Dependencies.stub(:legacy_rack?).and_return(true)
7
- end
8
-
9
- it "should run the handler with the application" do
10
- server = double(:server)
11
- port = 1234
12
- application = double(:application)
13
- Rack::Handler.should_receive(:get).with("webrick").and_return(server)
14
- server.should_receive(:run).with(application, hash_including(:Port => port))
15
- Jasmine::Server.new(port, application).start
4
+ before do
5
+ if !Rack.constants.include?(:Server)
6
+ Rack::Server = double("Rack::Server")
16
7
  end
8
+ @fake_env = {}
17
9
  end
18
10
 
19
- describe "rack >= 1.1" do
20
- before do
21
- Jasmine::Dependencies.stub(:legacy_rack?).and_return(false)
22
- if !Rack.constants.include?(:Server)
23
- Rack::Server = double("Rack::Server")
24
- end
25
- end
26
-
27
- it "should create a Rack::Server with the correct port when passed" do
28
- port = 1234
29
- Rack::Server.should_receive(:new).with(hash_including(:Port => port)).and_return(double(:server).as_null_object)
30
- Jasmine::Server.new(port, double(:app)).start
31
- end
32
-
33
- it "should start the server" do
34
- server = double(:server)
35
- Rack::Server.should_receive(:new) { server.as_null_object }
36
- server.should_receive(:start)
37
- Jasmine::Server.new('8888', double(:app)).start
38
- end
11
+ it "should start the server" do
12
+ expect(Rack::Server).to receive(:start) { double(:server).as_null_object }
13
+ Jasmine::Server.new('8888', double(:app), nil, @fake_env).start
14
+ end
39
15
 
40
- it "should set the app as the instance variable on the rack server" do
41
- app = double('application')
42
- server = double(:server)
43
- Rack::Server.should_receive(:new) { server.as_null_object }
44
- Jasmine::Server.new(1234, app).start
45
- server.instance_variable_get(:@app).should == app
46
- end
16
+ it "should pass rack options when starting the server" do
17
+ app = double('application')
18
+ expect(Rack::Server).to receive(:start).with(hash_including(:app => app, :Port => 1234, :foo => 'bar')).and_return(double(:server).as_null_object)
19
+ Jasmine::Server.new(1234, app, {:foo => 'bar', :Port => 4321}, @fake_env).start
20
+ expect(@fake_env['PORT']).to eq('1234')
47
21
  end
48
22
  end
data/spec/spec_helper.rb CHANGED
@@ -11,8 +11,14 @@ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '../lib')))
11
11
  require 'jasmine'
12
12
  require 'rspec'
13
13
 
14
- def create_rails(name)
15
- `rails new #{name}`
14
+ def rails_available?
15
+ if Gem::Specification.respond_to?(:find_by_name)
16
+ Gem::Specification.find_by_name('railties', '>= 3')
17
+ elsif Gem.respond_to?(:available?)
18
+ Gem.available?('railties', '>= 3')
19
+ end
20
+ rescue Gem::LoadError
21
+ false
16
22
  end
17
23
 
18
24
  def create_temp_dir
@@ -58,11 +64,37 @@ module Kernel
58
64
  end
59
65
 
60
66
  def passing_raw_result
61
- {'id' => 123, 'status' => 'passed', 'fullName' => 'Passing test', 'description' => 'Passing', 'failedExpectations' => []}
67
+ {
68
+ 'id' => 123,
69
+ 'status' => 'passed',
70
+ 'fullName' => 'Passing test',
71
+ 'description' => 'Passing',
72
+ 'failedExpectations' => [],
73
+ 'deprecationWarnings' => []
74
+ }
62
75
  end
63
76
 
64
77
  def pending_raw_result
65
- {'id' => 123, 'status' => 'pending', 'fullName' => 'Passing test', 'description' => 'Pending', 'failedExpectations' => []}
78
+ {
79
+ 'id' => 123,
80
+ 'status' => 'pending',
81
+ 'fullName' => 'Passing test',
82
+ 'description' => 'Pending',
83
+ 'failedExpectations' => [],
84
+ 'pendingReason' => 'I pend because',
85
+ 'deprecationWarnings' => []
86
+ }
87
+ end
88
+
89
+ def disabled_raw_result
90
+ {
91
+ 'id' => 123,
92
+ 'status' => 'disabled',
93
+ 'fullName' => 'Disabled test',
94
+ 'description' => 'Disabled',
95
+ 'failedExpectations' => [],
96
+ 'deprecationWarnings' => []
97
+ }
66
98
  end
67
99
 
68
100
  def failing_raw_result
@@ -76,7 +108,8 @@ def failing_raw_result
76
108
  'message' => 'a failure message',
77
109
  'stack' => 'a stack trace'
78
110
  }
79
- ]
111
+ ],
112
+ 'deprecationWarnings' => []
80
113
  }
81
114
  end
82
115
 
@@ -91,7 +124,22 @@ def failing_result_no_stack_trace
91
124
  'message' => 'a failure message, but no stack',
92
125
  'stack' => nil
93
126
  }
94
- ]
127
+ ],
128
+ 'deprecationWarnings' => []
129
+ }
130
+ end
131
+
132
+ def deprecation_raw_result
133
+ {
134
+ 'id' => 123,
135
+ 'status' => 'passed',
136
+ 'fullName' => 'test with deprecated calls',
137
+ 'description' => 'Deprecations',
138
+ 'failedExpectations' => [],
139
+ 'deprecationWarnings' => [{
140
+ 'message' => 'deprecated call',
141
+
142
+ }]
95
143
  }
96
144
  end
97
145
 
@@ -8,7 +8,7 @@ describe Jasmine::YamlConfigParser do
8
8
  end
9
9
  end
10
10
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
11
- parser.src_dir.should == 'some_project_root'
11
+ expect(parser.src_dir).to eq 'some_project_root'
12
12
  end
13
13
 
14
14
  it "src_dir returns src_dir if set" do
@@ -18,7 +18,7 @@ describe Jasmine::YamlConfigParser do
18
18
  end
19
19
  end
20
20
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
21
- parser.src_dir.should == File.join('some_project_root', 'some_src_dir')
21
+ expect(parser.src_dir).to eq File.join('some_project_root', 'some_src_dir')
22
22
  end
23
23
 
24
24
  it "jasmine_dir returns nil when jasmine dir is blank" do
@@ -28,7 +28,7 @@ describe Jasmine::YamlConfigParser do
28
28
  end
29
29
  end
30
30
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
31
- parser.jasmine_dir.should be_nil
31
+ expect(parser.jasmine_dir).to be_nil
32
32
  end
33
33
 
34
34
  it "jasmine_dir returns jasmine_dir if set" do
@@ -38,7 +38,7 @@ describe Jasmine::YamlConfigParser do
38
38
  end
39
39
  end
40
40
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
41
- parser.jasmine_dir.should == File.join('some_project_root', 'some_jasmine_dir')
41
+ expect(parser.jasmine_dir).to eq File.join('some_project_root', 'some_jasmine_dir')
42
42
  end
43
43
 
44
44
  it "spec_helper returns default helper path when spec_helper is blank" do
@@ -48,7 +48,7 @@ describe Jasmine::YamlConfigParser do
48
48
  end
49
49
  end
50
50
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
51
- parser.spec_helper.should == 'some_project_root/spec/javascripts/support/jasmine_helper.rb'
51
+ expect(parser.spec_helper).to eq 'some_project_root/spec/javascripts/support/jasmine_helper.rb'
52
52
  end
53
53
 
54
54
  it "spec_helper returns spec_helper if set" do
@@ -58,7 +58,7 @@ describe Jasmine::YamlConfigParser do
58
58
  end
59
59
  end
60
60
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
61
- parser.spec_helper.should == 'some_project_root/some_spec_helper.rb'
61
+ expect(parser.spec_helper).to eq 'some_project_root/some_spec_helper.rb'
62
62
  end
63
63
 
64
64
  it "boot_dir returns nil when boot dir is blank" do
@@ -68,7 +68,7 @@ describe Jasmine::YamlConfigParser do
68
68
  end
69
69
  end
70
70
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
71
- parser.boot_dir.should be_nil
71
+ expect(parser.boot_dir).to be_nil
72
72
  end
73
73
 
74
74
  it "boot_dir returns boot_dir if set" do
@@ -78,7 +78,7 @@ describe Jasmine::YamlConfigParser do
78
78
  end
79
79
  end
80
80
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
81
- parser.boot_dir.should == File.join('some_project_root', 'some_boot_dir')
81
+ expect(parser.boot_dir).to eq File.join('some_project_root', 'some_boot_dir')
82
82
  end
83
83
 
84
84
  it "spec_dir uses default path when spec dir is blank" do
@@ -88,7 +88,7 @@ describe Jasmine::YamlConfigParser do
88
88
  end
89
89
  end
90
90
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
91
- parser.spec_dir.should == File.join('some_project_root', 'spec', 'javascripts')
91
+ expect(parser.spec_dir).to eq File.join('some_project_root', 'spec', 'javascripts')
92
92
  end
93
93
 
94
94
  it "spec_dir returns spec_dir if set" do
@@ -98,7 +98,7 @@ describe Jasmine::YamlConfigParser do
98
98
  end
99
99
  end
100
100
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', nil, yaml_loader)
101
- parser.spec_dir.should == File.join('some_project_root', 'some_spec_dir')
101
+ expect(parser.spec_dir).to eq File.join('some_project_root', 'some_spec_dir')
102
102
  end
103
103
 
104
104
  it "expands src_file paths" do
@@ -115,7 +115,7 @@ describe Jasmine::YamlConfigParser do
115
115
 
116
116
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
117
117
 
118
- parser.src_files.should == ['expected_results']
118
+ expect(parser.src_files).to eq ['expected_results']
119
119
  end
120
120
 
121
121
  it "expands stylesheets paths" do
@@ -132,7 +132,7 @@ describe Jasmine::YamlConfigParser do
132
132
 
133
133
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
134
134
 
135
- parser.css_files.should == ['expected_results']
135
+ expect(parser.css_files).to eq ['expected_results']
136
136
  end
137
137
 
138
138
  it "expands spec_file paths" do
@@ -149,7 +149,7 @@ describe Jasmine::YamlConfigParser do
149
149
 
150
150
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
151
151
 
152
- parser.spec_files.should == ['expected_results']
152
+ expect(parser.spec_files).to eq ['expected_results']
153
153
  end
154
154
 
155
155
  it "expands jasmine_file paths" do
@@ -166,7 +166,7 @@ describe Jasmine::YamlConfigParser do
166
166
 
167
167
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
168
168
 
169
- parser.jasmine_files.should == ['expected_results']
169
+ expect(parser.jasmine_files).to eq ['expected_results']
170
170
  end
171
171
 
172
172
  it "expands boot_file paths" do
@@ -183,7 +183,7 @@ describe Jasmine::YamlConfigParser do
183
183
 
184
184
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
185
185
 
186
- parser.boot_files.should == ['expected_results']
186
+ expect(parser.boot_files).to eq ['expected_results']
187
187
  end
188
188
 
189
189
  it "expands jasmine css file paths" do
@@ -200,7 +200,7 @@ describe Jasmine::YamlConfigParser do
200
200
 
201
201
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
202
202
 
203
- parser.jasmine_css_files.should == ['expected_results']
203
+ expect(parser.jasmine_css_files).to eq ['expected_results']
204
204
  end
205
205
 
206
206
  it "expands helper paths" do
@@ -217,7 +217,7 @@ describe Jasmine::YamlConfigParser do
217
217
 
218
218
  parser = Jasmine::YamlConfigParser.new('some_path', 'some_project_root', expander, yaml_loader)
219
219
 
220
- parser.helpers.should == ['expected_results']
220
+ expect(parser.helpers).to eq ['expected_results']
221
221
  end
222
222
 
223
223
  it "doesn't blow up when blank values are passed" do
@@ -230,10 +230,10 @@ describe Jasmine::YamlConfigParser do
230
230
  end
231
231
 
232
232
  parser = Jasmine::YamlConfigParser.new({}, 'some_project_root', expander, yaml_loader)
233
- parser.src_files.should == []
234
- parser.spec_files.should == []
235
- parser.css_files.should == []
236
- parser.helpers.should == []
233
+ expect(parser.src_files).to eq []
234
+ expect(parser.spec_files).to eq []
235
+ expect(parser.css_files).to eq []
236
+ expect(parser.helpers).to eq []
237
237
  end
238
238
 
239
239
  end