jasmine 2.6.0 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6e4feb31d891edcde8c1fc8f2b376dd2702c36d
4
- data.tar.gz: 4aaf7e86cd765c88ef134656b6c009244a319f5b
3
+ metadata.gz: 52deb510769314254a492ff4249de9f05611b556
4
+ data.tar.gz: aea92ab6a204385dfde29409543117dcb4ab4c2e
5
5
  SHA512:
6
- metadata.gz: 0704ccd63ed7ceea4fcb83271fb3985264a955e88c17297ab211c787c18b937351a9f3f3859c5a22d0cecd3cbe457953d3b3bbac467a82595ccc8500e93d740e
7
- data.tar.gz: 014f79dc012747bb22e6ff6141dee04f6333f3466d10fba0f76f0ff612f0b05163a6617e4615eeea15b7818c98cc1aafb23f81e01e34e75f98fe5157c52de9da
6
+ metadata.gz: 726c7614bbdafc676f410db7b663688829d397b710b2ddfffbe0be4ffb76ab5cdfd91564245fc2a2cb4e16abcd8e6fcae016fb93716023d94daa31801f0f0b6d
7
+ data.tar.gz: 9a21eae3801cc9b3cc648db60a088b9d27417b7d889ce76ff11bdda5dd2a97ba4c60fb4de3157e3990588907ff278556f7127f5591a6a09b0427a65d5284c423
data/jasmine.gemspec CHANGED
@@ -1,17 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
  require "jasmine/version"
4
-
5
- def ruby_version_less_than(target_version)
6
- version_parts = RUBY_VERSION.split('.').map(&:to_i).zip(target_version)
7
-
8
- version_parts.each do |(current_part, target_part)|
9
- if current_part < target_part
10
- return true
11
- end
12
- end
13
- false
14
- end
4
+ require "jasmine/ruby_versions"
15
5
 
16
6
  Gem::Specification.new do |s|
17
7
  s.name = %q{jasmine}
@@ -51,7 +41,7 @@ Gem::Specification.new do |s|
51
41
  s.add_development_dependency 'nokogiri'
52
42
  end
53
43
 
54
- s.add_dependency 'jasmine-core', '>= 2.6.0', '< 3.0.0'
44
+ s.add_dependency 'jasmine-core', '>= 2.7.0', '< 3.0.0'
55
45
  s.add_dependency 'rack', '>= 1.2.1'
56
46
  s.add_dependency 'rake'
57
47
  s.add_dependency 'phantomjs'
data/lib/jasmine/base.rb CHANGED
@@ -23,7 +23,7 @@ module Jasmine
23
23
  require 'socket'
24
24
  begin
25
25
  socket = TCPSocket.open(hostname, port)
26
- rescue Errno::ECONNREFUSED, Errno::ENETUNREACH, Errno::EAFNOSUPPORT
26
+ rescue Errno::ECONNREFUSED, Errno::ENETUNREACH, Errno::EAFNOSUPPORT, Errno::EADDRNOTAVAIL, Errno::EHOSTUNREACH
27
27
  return false
28
28
  end
29
29
  socket.close
@@ -108,9 +108,8 @@ module Jasmine
108
108
  config.css_files = lambda { yaml_config.css_files }
109
109
 
110
110
  config.spec_dir = yaml_config.spec_dir
111
- config.helper_files = yaml_config.helpers
112
- config.spec_files = yaml_config.spec_files
113
- config.testing_files = lambda { config.helper_files + config.spec_files }
111
+ config.helper_files = lambda { yaml_config.helpers }
112
+ config.spec_files = lambda { yaml_config.spec_files }
114
113
 
115
114
  config.show_console_log = yaml_config.show_console_log
116
115
  config.stop_spec_on_expectation_failure = yaml_config.stop_spec_on_expectation_failure
@@ -127,8 +126,8 @@ module Jasmine
127
126
 
128
127
  def self.load_spec(spec_path)
129
128
  return if spec_path.nil?
130
- Jasmine.configure do |c|
131
- c.spec_files = [spec_path]
129
+ Jasmine.configure do |c|
130
+ c.spec_files = lambda { [spec_path] }
132
131
  end
133
132
  end
134
133
  end
@@ -2,8 +2,8 @@ module Jasmine
2
2
  class Configuration
3
3
  attr_writer :jasmine_css_files, :css_files
4
4
  attr_writer :jasmine_files, :boot_files, :src_files, :runner_boot_files
5
- attr_accessor :helper_files, :spec_files, :testing_files
6
- attr_accessor :jasmine_path, :spec_path, :boot_path, :src_path, :image_path, :runner_boot_path, :helper_files
5
+ attr_accessor :helper_files, :spec_files
6
+ attr_accessor :jasmine_path, :spec_path, :boot_path, :src_path, :image_path, :runner_boot_path
7
7
  attr_accessor :jasmine_dir, :spec_dir, :boot_dir, :src_dir, :images_dir, :runner_boot_dir
8
8
  attr_accessor :formatters
9
9
  attr_accessor :host
@@ -28,7 +28,9 @@ module Jasmine
28
28
  @boot_files = lambda { [] }
29
29
  @runner_boot_files = lambda { [] }
30
30
  @src_files = lambda { [] }
31
- @testing_files = lambda { [] }
31
+ @helper_files = lambda { [] }
32
+ @spec_files = lambda { [] }
33
+ @testing_files = lambda { helper_files.call + spec_files.call}
32
34
  @runner = lambda { |config| }
33
35
  @rack_options = {}
34
36
  @show_console_log = false
@@ -18,10 +18,6 @@ module Jasmine
18
18
  defined?(Rails) && Rails.respond_to?(:version)
19
19
  end
20
20
 
21
- def legacy_rack?
22
- !defined?(Rack::Server)
23
- end
24
-
25
21
  def use_asset_pipeline?
26
22
  assets_pipeline_available = (rails3? || rails4? || rails5?) && Rails.respond_to?(:application) && Rails.application.respond_to?(:assets)
27
23
  rails3_assets_enabled = rails3? && assets_pipeline_available && Rails.application.config.assets.enabled != false
@@ -0,0 +1,11 @@
1
+ def ruby_version_less_than(target_version)
2
+ version_parts = RUBY_VERSION.split('.').map(&:to_i).zip(target_version)
3
+
4
+ version_parts.each do |(current_part, target_part)|
5
+ if current_part < target_part
6
+ return true
7
+ end
8
+ end
9
+ false
10
+ end
11
+
@@ -9,15 +9,9 @@ module Jasmine
9
9
 
10
10
  def start
11
11
  @env['PORT'] = @port.to_s
12
- if Jasmine::Dependencies.legacy_rack?
13
- handler = Rack::Handler.get('webrick')
14
- handler.run(@application, :Port => @port, :AccessLog => [])
15
- else
16
- server = Rack::Server.new(@rack_options.merge(:Port => @port, :AccessLog => []))
17
- # workaround for Rack bug, when Rack > 1.2.1 is released Rack::Server.start(:app => Jasmine.app(self)) will work
18
- server.instance_variable_set(:@app, @application)
19
- server.start
20
- end
12
+ Rack::Server.start(@rack_options.merge(:Port => @port,
13
+ :AccessLog => [],
14
+ :app => @application))
21
15
  end
22
16
  end
23
17
  end
@@ -1,3 +1,3 @@
1
1
  module Jasmine
2
- VERSION = "2.6.0"
2
+ VERSION = "2.7.0"
3
3
  end
@@ -0,0 +1,11 @@
1
+ # Jasmine Gem 2.6.1 Release Notes
2
+
3
+ ## Pull Requests and Issues
4
+
5
+ * Remove old code for legacy rack and set up the Jasmine application through proper channels
6
+ - Fixes [#284](https://github.com/jasmine/jasmine-gem/issues/284)
7
+
8
+
9
+ ------
10
+
11
+ _Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
@@ -0,0 +1,28 @@
1
+ # Jasmine Gem 2.7.0 Release Notes
2
+
3
+ ## Summary
4
+
5
+ This release updates the jasmine-core dependency to 2.7.0. See the
6
+ [jasmine-core release notes](https://github.com/jasmine/jasmine/blob/master/release_notes/2.7.0.md)
7
+ for more information
8
+
9
+ ## Changes
10
+
11
+ * Properly pick up new spec and helper files without having to restart
12
+
13
+ ## Pull Requests and Issues
14
+
15
+ * catch Errno::EHOSTUNREACH while testing Jasmine#server_is_listening_on
16
+ - Merges [#288](https://github.com/jasmine/jasmine-gem/issues/288) from @doooby
17
+
18
+ * Catch error "Errno::EADDRNOTAVAIL", if check socket connection at cli mode
19
+ - Merges [#286](https://github.com/jasmine/jasmine-gem/issues/286) from @websi
20
+ - Fixes [#285](https://github.com/jasmine/jasmine-gem/issues/285)
21
+
22
+ * Remove old code for legacy rack and set up the Jasmine application through proper channels
23
+ - Fixes [#284](https://github.com/jasmine/jasmine-gem/issues/284)
24
+
25
+
26
+ ------
27
+
28
+ _Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
@@ -5,10 +5,10 @@ describe "Jasmine::Application" do
5
5
  it "includes no-cache headers for specs" do
6
6
  pending
7
7
  get "/__spec__/example_spec.js"
8
- last_response.headers.should have_key("Cache-Control")
9
- last_response.headers["Cache-Control"].should == "max-age=0, private, must-revalidate"
8
+ expect(last_response.headers).to have_key("Cache-Control")
9
+ expect(last_response.headers["Cache-Control"]).to eq "max-age=0, private, must-revalidate"
10
10
  last_response.headers['Pragma'].each do |key|
11
- last_response.headers[key].should == 'no-cache'
11
+ expect(last_response.headers[key]).to eq 'no-cache'
12
12
  end
13
13
  end
14
14
 
@@ -11,20 +11,20 @@ describe 'Jasmine::Application' do
11
11
  builder = double('Rack::Builder.new')
12
12
  #Rack::Builder instance evals, so builder.run is invalid syntax,
13
13
  #this is the only way to stub out the 'run' dsl it gives to the block.
14
- Jasmine::Application.stub(:run).with(handler1).and_return(app1)
15
- Jasmine::Application.stub(:run).with(handler2).and_return(app2)
14
+ allow(Jasmine::Application).to receive(:run).with(handler1).and_return(app1)
15
+ allow(Jasmine::Application).to receive(:run).with(handler2).and_return(app2)
16
16
 
17
- builder.should_receive(:map).twice do |path, &app|
17
+ expect(builder).to receive(:map).twice do |path, &app|
18
18
  if path == '/foo'
19
- app.call.should == app1
19
+ expect(app.call).to eq app1
20
20
  elsif path == '/bar'
21
- app.call.should == app2
21
+ expect(app.call).to eq app2
22
22
  else
23
23
  raise 'Unexpected path passed'
24
24
  end
25
25
  end
26
26
 
27
- Jasmine::Application.app(config, builder).should == builder
27
+ expect(Jasmine::Application.app(config, builder)).to eq builder
28
28
  end
29
29
 
30
30
  it 'should run rack apps provided by the config' do
@@ -40,16 +40,16 @@ describe 'Jasmine::Application' do
40
40
  { :app => app4, :args => [:bar] }
41
41
  ])
42
42
  builder = double('Rack::Builder.new')
43
- builder.should_receive(:use).with(app1)
44
- builder.should_receive(:use) do |*args, &arg_block|
45
- args.should == [app2]
46
- arg_block.should == block
43
+ expect(builder).to receive(:use).with(app1)
44
+ expect(builder).to receive(:use) do |*args, &arg_block|
45
+ expect(args).to eq [app2]
46
+ expect(arg_block).to eq block
47
47
  end
48
- builder.should_receive(:use) do |*args, &arg_block|
49
- args.should == [app3, :foo, :bar]
50
- arg_block.should == block
48
+ expect(builder).to receive(:use) do |*args, &arg_block|
49
+ expect(args).to eq [app3, :foo, :bar]
50
+ expect(arg_block).to eq block
51
51
  end
52
- builder.should_receive(:use).with(app4, :bar)
53
- Jasmine::Application.app(config, builder).should == builder
52
+ expect(builder).to receive(:use).with(app4, :bar)
53
+ expect(Jasmine::Application.app(config, builder)).to eq builder
54
54
  end
55
- end
55
+ end
data/spec/base_spec.rb CHANGED
@@ -2,32 +2,34 @@ require 'spec_helper'
2
2
 
3
3
  describe Jasmine do
4
4
  it "should provide the root path" do
5
- File.stub(:dirname).and_return('lib/jasmine')
6
- File.should_receive(:expand_path) { |path| path }
7
- Jasmine.root.should == 'lib/jasmine'
5
+ allow(File).to receive(:dirname).and_return('lib/jasmine')
6
+ expect(File).to receive(:expand_path) { |path| path }
7
+ expect(Jasmine.root).to eq 'lib/jasmine'
8
8
  end
9
+
9
10
  it "should append passed file paths" do
10
- File.stub(:dirname).and_return('lib/jasmine')
11
- File.should_receive(:expand_path) { |path| path }
12
- Jasmine.root('subdir1', 'subdir2').should == File.join('lib/jasmine', 'subdir1', 'subdir2')
11
+ allow(File).to receive(:dirname).and_return('lib/jasmine')
12
+ expect(File).to receive(:expand_path) { |path| path }
13
+ expect(Jasmine.root('subdir1', 'subdir2')).to eq File.join('lib/jasmine', 'subdir1', 'subdir2')
13
14
  end
15
+
14
16
  describe '#load_spec' do
15
17
  it 'assigns the spec to the spec path' do
16
18
  Jasmine.load_spec("spec/test")
17
- Jasmine.config.spec_files.should == [ "spec/test" ]
19
+ expect(Jasmine.config.spec_files.call).to eq [ "spec/test" ]
18
20
  end
19
21
 
20
22
  it 'does not assign a spec path if passed a nil' do
21
23
  Jasmine.load_spec("spec/test")
22
24
  Jasmine.load_spec(nil)
23
- Jasmine.config.spec_files.should == [ "spec/test" ]
25
+ expect(Jasmine.config.spec_files.call).to eq [ "spec/test" ]
24
26
  end
25
27
 
26
28
  it 'does not override nonspec files' do
27
- Jasmine.config.helper_files = ["aaa"]
29
+ Jasmine.config.helper_files = lambda { ["aaa"] }
28
30
  Jasmine.load_spec("spec/test")
29
- Jasmine.config.spec_files.should == [ "spec/test" ]
30
- Jasmine.config.helper_files.should == ["aaa"]
31
+ expect(Jasmine.config.spec_files.call).to eq [ "spec/test" ]
32
+ expect(Jasmine.config.helper_files.call).to eq ["aaa"]
31
33
  end
32
34
  end
33
35
  end
@@ -53,10 +53,10 @@ describe Jasmine::Configuration do
53
53
  config.add_path_mapper(lambda { |c| test_mapper1.new(c) })
54
54
  config.add_path_mapper(lambda { |c| test_mapper2.new(c) })
55
55
  config.add_path_mapper(lambda { |c| test_mapper3.new(c) })
56
- config.css_files.should == []
56
+ expect(config.css_files).to eq []
57
57
  config.jasmine_css_files = lambda { %w(jasmine_css) }
58
58
  config.css_files = lambda { %w(css) }
59
- config.css_files.should == %w(mapped_jasmine/jasmine_css/jasmine mapped_src/css/src)
59
+ expect(config.css_files).to eq %w(mapped_jasmine/jasmine_css/jasmine mapped_src/css/src)
60
60
  end
61
61
  end
62
62
 
@@ -66,14 +66,16 @@ describe Jasmine::Configuration do
66
66
  config.add_path_mapper(lambda { |c| test_mapper1.new(c) })
67
67
  config.add_path_mapper(lambda { |c| test_mapper2.new(c) })
68
68
  config.add_path_mapper(lambda { |c| test_mapper3.new(c) })
69
- config.js_files.should == []
69
+ expect(config.js_files).to eq []
70
70
  config.jasmine_files = lambda { %w(jasmine) }
71
71
  config.src_files = lambda { %w(src) }
72
72
  config.boot_files = lambda { %w(boot) }
73
- config.testing_files = lambda { %w(spec) }
74
- config.js_files.should == %w(
73
+ config.spec_files = lambda { %w(spec) }
74
+ config.helper_files = lambda { %w(helper) }
75
+ expect(config.js_files).to eq %w(
75
76
  mapped_jasmine/jasmine/jasmine
76
77
  mapped_boot/boot/boot mapped_src/src/src
78
+ mapped_spec/helper/spec
77
79
  mapped_spec/spec/spec)
78
80
  end
79
81
  end
@@ -84,8 +86,8 @@ describe Jasmine::Configuration do
84
86
  result = double
85
87
  config.add_rack_path('some/path', lambda { result })
86
88
  map = config.rack_path_map
87
- map['some/path'].should be
88
- map['some/path'].call.should == result
89
+ expect(map['some/path']).to be
90
+ expect(map['some/path'].call).to eq result
89
91
  end
90
92
  end
91
93
 
@@ -94,7 +96,7 @@ describe Jasmine::Configuration do
94
96
  config = Jasmine::Configuration.new()
95
97
  app = double
96
98
  config.add_rack_app(app)
97
- config.rack_apps.should == [{ :app => app, :args => [], :block => nil }]
99
+ expect(config.rack_apps).to eq [{ :app => app, :args => [], :block => nil }]
98
100
  end
99
101
 
100
102
  it 'permits the addition of arbitary rack apps with a config block' do
@@ -102,14 +104,14 @@ describe Jasmine::Configuration do
102
104
  app = double
103
105
  block = lambda { 'foo' }
104
106
  config.add_rack_app(app, &block)
105
- config.rack_apps.should == [{ :app => app, :args => [], :block => block }]
107
+ expect(config.rack_apps).to eq [{ :app => app, :args => [], :block => block }]
106
108
  end
107
109
 
108
110
  it 'permits the addition of arbitary rack apps with arbitrary config' do
109
111
  config = Jasmine::Configuration.new()
110
112
  app = double
111
113
  config.add_rack_app(app, { :foo => 'bar' })
112
- config.rack_apps.should == [{ :app => app, :args => [{ :foo => 'bar' }], :block => nil }]
114
+ expect(config.rack_apps).to eq [{ :app => app, :args => [{ :foo => 'bar' }], :block => nil }]
113
115
  end
114
116
 
115
117
  it 'permits the addition of arbitary rack apps with arbitrary config and a config block' do
@@ -117,19 +119,19 @@ describe Jasmine::Configuration do
117
119
  app = double
118
120
  block = lambda { 'foo' }
119
121
  config.add_rack_app(app, { :foo => 'bar' }, &block)
120
- config.rack_apps.should == [{ :app => app, :args => [{ :foo => 'bar' }], :block => block }]
122
+ expect(config.rack_apps).to eq [{ :app => app, :args => [{ :foo => 'bar' }], :block => block }]
121
123
  end
122
124
  end
123
125
 
124
126
  describe 'host' do
125
127
  it 'should default to localhost' do
126
- Jasmine::Configuration.new().host.should == 'http://localhost'
128
+ expect(Jasmine::Configuration.new().host).to eq 'http://localhost'
127
129
  end
128
130
 
129
131
  it 'returns host if set' do
130
132
  config = Jasmine::Configuration.new()
131
133
  config.host = 'foo'
132
- config.host.should == 'foo'
134
+ expect(config.host).to eq 'foo'
133
135
  end
134
136
  end
135
137
 
@@ -137,7 +139,7 @@ describe Jasmine::Configuration do
137
139
  it 'returns value if set' do
138
140
  config = Jasmine::Configuration.new()
139
141
  config.spec_format = 'fish'
140
- config.spec_format.should == 'fish'
142
+ expect(config.spec_format).to eq 'fish'
141
143
  end
142
144
  end
143
145
 
@@ -145,7 +147,7 @@ describe Jasmine::Configuration do
145
147
  it 'returns value if set' do
146
148
  config = Jasmine::Configuration.new()
147
149
  config.prevent_phantom_js_auto_install = true
148
- config.prevent_phantom_js_auto_install.should == true
150
+ expect(config.prevent_phantom_js_auto_install).to eq true
149
151
  end
150
152
  end
151
153
 
@@ -153,36 +155,36 @@ describe Jasmine::Configuration do
153
155
  it 'returns value if set' do
154
156
  config = Jasmine::Configuration.new()
155
157
  config.show_full_stack_trace = true
156
- config.show_full_stack_trace.should == true
158
+ expect(config.show_full_stack_trace).to eq true
157
159
  end
158
160
  end
159
161
 
160
162
  describe 'jasmine ports' do
161
163
  it 'returns new CI port and caches return value' do
162
164
  config = Jasmine::Configuration.new()
163
- Jasmine.stub(:find_unused_port).and_return('1234')
164
- config.port(:ci).should == '1234'
165
- Jasmine.stub(:find_unused_port).and_return('4321')
166
- config.port(:ci).should == '1234'
165
+ allow(Jasmine).to receive(:find_unused_port).and_return('1234')
166
+ expect(config.port(:ci)).to eq '1234'
167
+ allow(Jasmine).to receive(:find_unused_port).and_return('4321')
168
+ expect(config.port(:ci)).to eq '1234'
167
169
  end
168
170
 
169
171
  it 'returns ci port if configured' do
170
172
  config = Jasmine::Configuration.new()
171
173
  config.ci_port = '5678'
172
- Jasmine.stub(:find_unused_port).and_return('1234')
173
- config.port(:ci).should == '5678'
174
+ allow(Jasmine).to receive(:find_unused_port).and_return('1234')
175
+ expect(config.port(:ci)).to eq '5678'
174
176
  end
175
177
 
176
178
  it 'returns configured server port' do
177
179
  config = Jasmine::Configuration.new()
178
180
  config.server_port = 'fish'
179
- config.port(:server).should == 'fish'
181
+ expect(config.port(:server)).to eq 'fish'
180
182
  end
181
183
 
182
184
  it 'returns default server port' do
183
185
  config = Jasmine::Configuration.new()
184
186
 
185
- config.port(:server).should == 8888
187
+ expect(config.port(:server)).to eq 8888
186
188
  end
187
189
  end
188
190
 
@@ -190,13 +192,13 @@ describe Jasmine::Configuration do
190
192
  it 'returns value if set' do
191
193
  config = Jasmine::Configuration.new()
192
194
  config.formatters = ['pants']
193
- config.formatters.should == ['pants']
195
+ expect(config.formatters).to eq ['pants']
194
196
  end
195
197
 
196
198
  it 'returns defaults' do
197
199
  config = Jasmine::Configuration.new()
198
200
 
199
- config.formatters.should == [Jasmine::Formatters::Console]
201
+ expect(config.formatters).to eq [Jasmine::Formatters::Console]
200
202
  end
201
203
  end
202
204
 
@@ -205,7 +207,7 @@ describe Jasmine::Configuration do
205
207
  config = Jasmine::Configuration.new
206
208
  foo = double(:foo)
207
209
  config.runner = foo
208
- config.runner.should == foo
210
+ expect(config.runner).to eq foo
209
211
  end
210
212
 
211
213
  it 'does nothing by default' do