jasmine 3.5.0 → 3.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -2
- data/Gemfile +2 -4
- data/README.markdown +16 -9
- data/jasmine.gemspec +4 -2
- data/lib/jasmine/asset_expander.rb +3 -3
- data/lib/jasmine/dependencies.rb +8 -2
- data/lib/jasmine/version.rb +1 -1
- data/release_notes/3.5.1.md +18 -0
- data/spec/jasmine_rails_spec.rb +138 -147
- data/spec/spec_helper.rb +21 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1c3adadebd009bfacd1fab26771b31c42b76ee42068e88cd61bc71e5a259c884
|
4
|
+
data.tar.gz: 82c143fa60146d38d0c5f1c920f36b63552d6a08040358a8d8bffcdbe0ff424a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7be5ec8f81a983be7dce34d006d46e836f39f27e455548ae73f4463e03d3886bfd5a9b4c831d2de814a42798feb6eff1e80d1a2f420706dd5fb6d81fb5a466e
|
7
|
+
data.tar.gz: 9ab969b3f529485c9633ad5d21e9953bead00bbe45ea9f8874ddccbf59cf862a152954410a1f5c1c85f08463120fadeab0895f3dab4e152331916b0e01d87b14
|
data/.travis.yml
CHANGED
@@ -7,23 +7,26 @@ addons:
|
|
7
7
|
|
8
8
|
rvm:
|
9
9
|
- "2.3"
|
10
|
-
- "2.4"
|
11
10
|
- "2.5"
|
12
11
|
- "2.6"
|
13
12
|
|
14
13
|
env:
|
14
|
+
- "RAILS_VERSION=rails6"
|
15
15
|
- "RAILS_VERSION=rails5"
|
16
16
|
- "RAILS_VERSION=rails4"
|
17
17
|
- "RAILS_VERSION=pojs"
|
18
18
|
|
19
19
|
script: "if [ $PERFORMANCE_SPECS ];then bundle exec rake performance_specs --trace; else bundle exec rake --trace; fi"
|
20
20
|
|
21
|
-
|
21
|
+
jobs:
|
22
22
|
fast_finish: true
|
23
23
|
include:
|
24
24
|
- env:
|
25
25
|
- "PERFORMANCE_SPECS=true"
|
26
26
|
- "RAILS_VERSION=rails5"
|
27
|
+
exclude:
|
28
|
+
- rvm: "2.3"
|
29
|
+
env: "RAILS_VERSION=rails6"
|
27
30
|
|
28
31
|
before_install:
|
29
32
|
- "if [$RAILS_VERSION != rails4 ];then gem update --system; fi"
|
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# The Jasmine Gem [![Build Status](https://travis-ci.org/jasmine/jasmine-gem.png?branch=master)](https://travis-ci.org/jasmine/jasmine-gem)
|
2
2
|
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fjasmine%2Fjasmine-gem.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fjasmine%2Fjasmine-gem?ref=badge_shield)
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/jasmine.svg)](https://badge.fury.io/rb/jasmine)
|
3
4
|
|
4
5
|
The [Jasmine](http://github.com/jasmine/jasmine) Ruby Gem is a package of helper code for developing Jasmine projects for Ruby-based web projects (Rails, Sinatra, etc.) or for JavaScript projects where Ruby is a welcome partner. It serves up a project's Jasmine suite in a browser so you can focus on your code instead of manually editing script tags in the Jasmine runner HTML file.
|
5
6
|
|
@@ -48,9 +49,11 @@ This uses PhantomJS to load and run the Jasmine suite.
|
|
48
49
|
|
49
50
|
Please note that PhantomJS will be auto-installed by the [phantomjs-gem][phantomjs-gem] at the first `rake jasmine:ci` run. If you have a matching PhantomJS version somewhere on your path, it won't install. You can disable automatic installation altogether (and use the PhantomJS on your path) via the config helper in your jasmine_helper.rb:
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
```ruby
|
53
|
+
Jasmine.configure do |config|
|
54
|
+
config.prevent_phantom_js_auto_install = true
|
55
|
+
end
|
56
|
+
```
|
54
57
|
|
55
58
|
[phantomjs-gem]: https://github.com/colszowka/phantomjs-gem#phantomjs-as-a-rubygem
|
56
59
|
|
@@ -74,17 +77,21 @@ To change the port that `rake jasmine` uses:
|
|
74
77
|
|
75
78
|
In your jasmine_helper.rb:
|
76
79
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
+
```ruby
|
81
|
+
Jasmine.configure do |config|
|
82
|
+
config.server_port = 5555
|
83
|
+
end
|
84
|
+
```
|
80
85
|
|
81
86
|
By default `rake jasmine:ci` will attempt to find a random open port, to set the port that `rake jasmine:ci` uses:
|
82
87
|
|
83
88
|
In your jasmine_helper.rb:
|
84
89
|
|
85
|
-
|
86
|
-
|
87
|
-
|
90
|
+
```ruby
|
91
|
+
Jasmine.configure do |config|
|
92
|
+
config.ci_port = 1234
|
93
|
+
end
|
94
|
+
```
|
88
95
|
|
89
96
|
## Using headless Chrome
|
90
97
|
|
data/jasmine.gemspec
CHANGED
@@ -26,8 +26,10 @@ Gem::Specification.new do |s|
|
|
26
26
|
when 'pojs'
|
27
27
|
when 'rails4'
|
28
28
|
s.add_development_dependency 'rails', '>= 4.2', '< 5.0.0'
|
29
|
-
|
30
|
-
s.add_development_dependency 'rails', '>= 5'
|
29
|
+
when 'rails5'
|
30
|
+
s.add_development_dependency 'rails', '>= 5', '< 6.0.0'
|
31
|
+
else #default to rails 6 - keep in sync with `rails_version` in spec_helper
|
32
|
+
s.add_development_dependency 'rails', '>= 6', '< 7.0.0'
|
31
33
|
end
|
32
34
|
|
33
35
|
s.add_development_dependency 'rack-test'
|
@@ -13,11 +13,11 @@ module Jasmine
|
|
13
13
|
UnsupportedRailsVersion = Class.new(StandardError)
|
14
14
|
|
15
15
|
def asset_bundle
|
16
|
-
return
|
17
|
-
raise UnsupportedRailsVersion, "Jasmine only supports the asset pipeline for Rails 4. -
|
16
|
+
return Rails4Or5Or6AssetBundle.new if Jasmine::Dependencies.rails4? || Jasmine::Dependencies.rails5? || Jasmine::Dependencies.rails6?
|
17
|
+
raise UnsupportedRailsVersion, "Jasmine only supports the asset pipeline for Rails 4. - 6"
|
18
18
|
end
|
19
19
|
|
20
|
-
class
|
20
|
+
class Rails4Or5Or6AssetBundle
|
21
21
|
def assets(pathname)
|
22
22
|
if pathname =~ /\.css$/
|
23
23
|
context.get_stylesheet_assets(pathname.gsub(/\.css$/, ''))
|
data/lib/jasmine/dependencies.rb
CHANGED
@@ -10,13 +10,19 @@ module Jasmine
|
|
10
10
|
rails? && Rails.version.to_i == 5
|
11
11
|
end
|
12
12
|
|
13
|
+
def rails6?
|
14
|
+
rails? && Rails.version.to_i == 6
|
15
|
+
end
|
16
|
+
|
13
17
|
def rails?
|
14
18
|
defined?(Rails) && Rails.respond_to?(:version)
|
15
19
|
end
|
16
20
|
|
17
21
|
def use_asset_pipeline?
|
18
|
-
|
19
|
-
|
22
|
+
(rails4? || rails5? || rails6?) &&
|
23
|
+
Rails.respond_to?(:application) &&
|
24
|
+
Rails.application.respond_to?(:assets) &&
|
25
|
+
!Rails.application.assets.nil?
|
20
26
|
end
|
21
27
|
end
|
22
28
|
end
|
data/lib/jasmine/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Jasmine Gem 3.5.1 Release Notes
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
|
5
|
+
This update allows the gem to continue working with Sprockets in Rails 6
|
6
|
+
|
7
|
+
## Changes
|
8
|
+
|
9
|
+
* Various readme improvements
|
10
|
+
- Merges #312 from @cprodhomme
|
11
|
+
|
12
|
+
* Allow Jasmine to continue to work with Rails 6
|
13
|
+
- Merges #310 from @cbaines
|
14
|
+
- Fixes #311
|
15
|
+
|
16
|
+
------
|
17
|
+
|
18
|
+
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
data/spec/jasmine_rails_spec.rb
CHANGED
@@ -4,10 +4,19 @@ require 'yaml'
|
|
4
4
|
require 'jasmine/ruby_versions'
|
5
5
|
|
6
6
|
if rails_available?
|
7
|
+
if !Bundler.respond_to?(:with_unbundled_env)
|
8
|
+
module Bundler
|
9
|
+
class << self
|
10
|
+
alias_method :with_unbundled_env, :with_clean_env
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
7
15
|
describe 'A Rails app' do
|
8
16
|
def bundle_install
|
9
|
-
|
17
|
+
bundle_output = `NOKOGIRI_USE_SYSTEM_LIBRARIES=true bundle install`
|
10
18
|
unless $?.success?
|
19
|
+
puts bundle_output
|
11
20
|
raise "Bundle failed to install."
|
12
21
|
end
|
13
22
|
end
|
@@ -16,26 +25,35 @@ if rails_available?
|
|
16
25
|
temp_dir_before
|
17
26
|
Dir::chdir @tmp
|
18
27
|
|
19
|
-
|
28
|
+
if rails_version == 'rails6'
|
29
|
+
`rails new rails-example --skip-bundle --skip-active-record --skip-bootsnap --skip-webpack-install --skip-javascript`
|
30
|
+
else
|
31
|
+
`rails new rails-example --skip-bundle --skip-active-record`
|
32
|
+
end
|
20
33
|
Dir::chdir File.join(@tmp, 'rails-example')
|
21
34
|
|
22
35
|
base = File.absolute_path(File.join(__FILE__, '../..'))
|
23
36
|
|
24
|
-
# execjs v2.2.0 is broken in rbx, locking the version to 2.0.2 for now
|
25
|
-
# see https://github.com/sstephenson/execjs/issues/148
|
26
|
-
|
27
37
|
open('Gemfile', 'a') { |f|
|
28
38
|
f.puts "gem 'jasmine', :path => '#{base}'"
|
29
39
|
f.puts "gem 'jasmine-core', :git => 'http://github.com/jasmine/jasmine.git'"
|
30
|
-
if RUBY_PLATFORM != 'java' &&
|
40
|
+
if RUBY_PLATFORM != 'java' && rails_version == 'rails4'
|
31
41
|
f.puts "gem 'thin'"
|
32
42
|
end
|
33
|
-
f.puts "gem 'angularjs-rails'"
|
34
|
-
f.puts "gem 'execjs', '2.0.2'"
|
35
43
|
f.flush
|
36
44
|
}
|
37
45
|
|
38
|
-
|
46
|
+
FileUtils.mkdir_p('.bundle')
|
47
|
+
open('.bundle/config', 'a') do |f|
|
48
|
+
f.puts(<<~YAML)
|
49
|
+
---
|
50
|
+
BUNDLE_PATH: "vendor"
|
51
|
+
BUNDLE_RETRY: "3"
|
52
|
+
YAML
|
53
|
+
f.flush
|
54
|
+
end
|
55
|
+
|
56
|
+
Bundler.with_unbundled_env do
|
39
57
|
bundle_install
|
40
58
|
`bundle exec rails g jasmine:install`
|
41
59
|
expect($?).to eq 0
|
@@ -47,6 +65,19 @@ if rails_available?
|
|
47
65
|
expect(File.exists?('spec/javascripts/jasmine_examples/PlayerSpec.js')).to eq true
|
48
66
|
expect(File.exists?('spec/javascripts/helpers/jasmine_examples/SpecHelper.js')).to eq true
|
49
67
|
end
|
68
|
+
|
69
|
+
if rails_version == 'rails6'
|
70
|
+
FileUtils.mkdir_p('app/assets/javascripts')
|
71
|
+
open('app/assets/javascripts/application.js', 'a') { |f|
|
72
|
+
f.puts '//= require_tree .'
|
73
|
+
f.flush
|
74
|
+
}
|
75
|
+
FileUtils.mkdir_p('app/assets/config')
|
76
|
+
open('app/assets/config/manifest.js', 'a') { |f|
|
77
|
+
f.puts '//= link_directory ../javascripts .js'
|
78
|
+
f.flush
|
79
|
+
}
|
80
|
+
end
|
50
81
|
end
|
51
82
|
|
52
83
|
after :all do
|
@@ -56,55 +87,23 @@ if rails_available?
|
|
56
87
|
it 'should have the jasmine & jasmine:ci rake task' do
|
57
88
|
#See https://github.com/jimweirich/rake/issues/220 and https://github.com/jruby/activerecord-jdbc-adapter/pull/467
|
58
89
|
#There's a workaround, but requires setting env vars & jruby opts (non-trivial when inside of a jruby process), so skip for now.
|
59
|
-
Bundler.
|
90
|
+
Bundler.with_unbundled_env do
|
60
91
|
output = `bundle exec rake -T`
|
61
92
|
expect(output).to include('jasmine ')
|
62
93
|
expect(output).to include('jasmine:ci')
|
63
94
|
end
|
64
95
|
end
|
65
96
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
it "rake jasmine:ci returns proper exit code when specs fail" do
|
75
|
-
Bundler.with_clean_env do
|
76
|
-
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'failing_test.js'), File.join('spec', 'javascripts'))
|
77
|
-
failing_yaml = custom_jasmine_config('failing') do |jasmine_config|
|
78
|
-
jasmine_config['spec_files'] << 'failing_test.js'
|
79
|
-
end
|
80
|
-
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{failing_yaml}`
|
81
|
-
expect($?).to_not be_success
|
82
|
-
expect(output).to include('6 specs, 1 failure')
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
it "rake jasmine:ci runs specs when an error occurs in the javascript" do
|
87
|
-
Bundler.with_clean_env do
|
88
|
-
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'exception_test.js'), File.join('spec', 'javascripts'))
|
89
|
-
exception_yaml = custom_jasmine_config('exception') do |jasmine_config|
|
90
|
-
jasmine_config['spec_files'] << 'exception_test.js'
|
91
|
-
end
|
92
|
-
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{exception_yaml}`
|
93
|
-
expect($?).to_not be_success
|
94
|
-
expect(output).to include('5 specs, 0 failures')
|
95
|
-
end
|
97
|
+
context 'with angular mocks' do
|
98
|
+
before(:all) do
|
99
|
+
open('spec/javascripts/helpers/angular_helper.js', 'w') { |f|
|
100
|
+
f.puts "//= require angular-mocks"
|
101
|
+
f.flush
|
102
|
+
}
|
96
103
|
end
|
97
104
|
|
98
|
-
|
99
|
-
|
100
|
-
jasmine_config['spec_files'] << 'coffee_spec.coffee'
|
101
|
-
end
|
102
|
-
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'coffee_spec.coffee'), File.join('spec', 'javascripts'))
|
103
|
-
|
104
|
-
Bundler.with_clean_env do
|
105
|
-
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{coffee_yaml}`
|
106
|
-
expect(output).to include('6 specs, 0 failures')
|
107
|
-
end
|
105
|
+
after(:all) do
|
106
|
+
FileUtils.rm('spec/javascripts/helpers/angular_helper.js')
|
108
107
|
end
|
109
108
|
|
110
109
|
it "rake jasmine runs and serves the expected webpage when using asset pipeline" do
|
@@ -113,114 +112,95 @@ if rails_available?
|
|
113
112
|
f.flush
|
114
113
|
}
|
115
114
|
|
116
|
-
open('spec/javascripts/helpers/angular_helper.js', 'w') { |f|
|
117
|
-
f.puts "//= require angular-mocks"
|
118
|
-
f.flush
|
119
|
-
}
|
120
|
-
|
121
115
|
css_yaml = custom_jasmine_config('css') do |jasmine_config|
|
122
116
|
jasmine_config['src_files'] = %w[assets/application.js http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js]
|
123
117
|
jasmine_config['stylesheets'] = ['assets/application.css']
|
124
118
|
end
|
125
119
|
|
120
|
+
Bundler.with_unbundled_env do
|
121
|
+
`bundle add angularjs-rails`
|
122
|
+
end
|
126
123
|
run_jasmine_server("JASMINE_CONFIG_PATH=#{css_yaml}") do
|
127
124
|
output = Net::HTTP.get(URI.parse('http://localhost:8888/'))
|
128
|
-
|
125
|
+
if rails_version == 'rails6'
|
126
|
+
expect(output).to match(%r{script src.*/(assets/application.debug-[^\.]+\.js)})
|
127
|
+
expect(output).to match(%r{<link rel=.stylesheet.*?href=.*/assets/application.debug-[^\.]+\.css})
|
128
|
+
else
|
129
|
+
expect(output).to match(%r{script src.*/assets/jasmine_examples/Player(\.self-[^\.]+)?\.js})
|
130
|
+
expect(output).to match(%r{script src.*/assets/jasmine_examples/Song(\.self-[^\.]+)?\.js})
|
131
|
+
expect(output).to match(%r{script src.*angular_helper\.js})
|
132
|
+
expect(output).to match(%r{<link rel=.stylesheet.*?href=./assets/foo(\.self-[^\.]+)?\.css\?.*?>})
|
133
|
+
end
|
129
134
|
expect(output).to match(%r{script src=['"]http://ajax\.googleapis\.com/ajax/libs/jquery/1\.11\.0/jquery\.min\.js})
|
130
|
-
expect(output).to match(%r{script src.*/assets/jasmine_examples/Song(\.self-[^\.]+)?\.js})
|
131
|
-
expect(output).to match(%r{script src.*angular_helper\.js})
|
132
|
-
expect(output).to match(%r{<link rel=.stylesheet.*?href=./assets/foo(\.self-[^\.]+)?\.css\?.*?>})
|
133
135
|
|
134
136
|
output = Net::HTTP.get(URI.parse('http://localhost:8888/__spec__/helpers/angular_helper.js'))
|
135
137
|
expect(output).to match(/angular\.mock/)
|
136
138
|
end
|
137
139
|
end
|
140
|
+
end
|
138
141
|
|
139
|
-
|
142
|
+
context 'with an assets_prefix set' do
|
143
|
+
before(:all) do
|
140
144
|
open('app/assets/stylesheets/assets_prefix.js.erb', 'w') { |f|
|
141
145
|
f.puts "<%= assets_prefix %>"
|
142
146
|
f.flush
|
143
147
|
}
|
148
|
+
end
|
144
149
|
|
150
|
+
after(:all) do
|
151
|
+
FileUtils.rm('app/assets/stylesheets/assets_prefix.js.erb')
|
152
|
+
end
|
153
|
+
|
154
|
+
it "sets assets_prefix when using sprockets" do
|
145
155
|
run_jasmine_server do
|
146
156
|
output = Net::HTTP.get(URI.parse('http://localhost:8888/assets/assets_prefix.js'))
|
147
157
|
expect(output).to match("/assets")
|
148
158
|
end
|
149
159
|
end
|
160
|
+
end
|
150
161
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
end
|
156
|
-
FileUtils.mkdir_p(File.join('public', 'javascripts'))
|
157
|
-
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'non_asset_pipeline.js'), File.join('public', 'javascripts'))
|
158
|
-
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'non_asset_pipeline_test.js'), File.join('spec', 'javascripts'))
|
159
|
-
|
160
|
-
Bundler.with_clean_env do
|
161
|
-
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{yaml}`
|
162
|
-
expect(output).to include('1 spec, 0 failures')
|
163
|
-
end
|
162
|
+
it "should load js files outside of the assets path too" do
|
163
|
+
yaml = custom_jasmine_config('public-assets') do |jasmine_config|
|
164
|
+
jasmine_config['src_files'] << 'public/javascripts/**/*.js'
|
165
|
+
jasmine_config['spec_files'] = ['non_asset_pipeline_test.js']
|
164
166
|
end
|
167
|
+
FileUtils.mkdir_p(File.join('public', 'javascripts'))
|
168
|
+
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'non_asset_pipeline.js'), File.join('public', 'javascripts'))
|
169
|
+
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'non_asset_pipeline_test.js'), File.join('spec', 'javascripts'))
|
165
170
|
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
jasmine_config['rack_options'] = { 'server' => 'webrick' }
|
170
|
-
end
|
171
|
-
|
172
|
-
Bundler.with_clean_env do
|
173
|
-
default_output = `bundle exec rake jasmine:ci`
|
174
|
-
if ENV['RAILS_VERSION'] == 'rails5' || ENV['RAILS_VERSION'].nil?
|
175
|
-
expect(default_output).to include('Puma starting')
|
176
|
-
else
|
177
|
-
expect(default_output).to include('Thin web server')
|
178
|
-
end
|
179
|
-
|
180
|
-
custom_output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{rack_yaml} 2>&1`
|
181
|
-
expect(custom_output).to include("WEBrick")
|
182
|
-
end
|
171
|
+
Bundler.with_unbundled_env do
|
172
|
+
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{yaml}`
|
173
|
+
expect(output).to include('1 spec, 0 failures')
|
183
174
|
end
|
175
|
+
end
|
184
176
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
open('Gemfile', 'a') { |f|
|
191
|
-
f.puts "gem 'sprockets', '~> 4.0.0.beta6'"
|
192
|
-
f.flush
|
193
|
-
}
|
194
|
-
Bundler.with_clean_env do
|
195
|
-
bundle_install
|
196
|
-
end
|
197
|
-
|
198
|
-
FileUtils.mkdir_p('app/assets/config')
|
177
|
+
it "should pass custom rack options from jasmine.yml" do
|
178
|
+
pending "we're testing this with thin, which doesn't work in jruby" if RUBY_PLATFORM == 'java'
|
179
|
+
rack_yaml = custom_jasmine_config('custom_rack') do |jasmine_config|
|
180
|
+
jasmine_config['rack_options'] = { 'server' => 'webrick' }
|
181
|
+
end
|
199
182
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
183
|
+
Bundler.with_unbundled_env do
|
184
|
+
default_output = `bundle exec rake jasmine:ci`
|
185
|
+
if rails_version == 'rails6' || rails_version == 'rails5' || rails_version.nil?
|
186
|
+
expect(default_output).to include('Puma starting')
|
187
|
+
else
|
188
|
+
expect(default_output).to include('Thin web server')
|
205
189
|
end
|
206
190
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
Bundler.with_clean_env do
|
212
|
-
bundle_install
|
213
|
-
end
|
214
|
-
end
|
191
|
+
custom_output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{rack_yaml} 2>&1`
|
192
|
+
expect(custom_output).to include("WEBrick")
|
193
|
+
end
|
194
|
+
end
|
215
195
|
|
196
|
+
if rails_version == 'rails6'
|
197
|
+
describe 'using sprockets 4' do
|
216
198
|
it "serves source mapped assets" do
|
217
199
|
run_jasmine_server do
|
218
200
|
output = Net::HTTP.get(URI.parse('http://localhost:8888/'))
|
219
201
|
|
220
202
|
js_match = output.match %r{script src.*/(assets/application.debug-[^\.]+\.js)}
|
221
|
-
|
222
203
|
expect(js_match).to_not be_nil
|
223
|
-
expect(output).to match(%r{<link rel=.stylesheet.*?href=.*/assets/application.debug-[^\.]+\.css})
|
224
204
|
|
225
205
|
js_path = js_match[1]
|
226
206
|
output = Net::HTTP.get(URI.parse("http://localhost:8888/#{js_path}"))
|
@@ -230,28 +210,17 @@ if rails_available?
|
|
230
210
|
end
|
231
211
|
end
|
232
212
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
f.puts "Jasmine.configure do |config|\n config.runner_browser = :chromeheadless\nend\n"
|
237
|
-
f.flush
|
238
|
-
}
|
239
|
-
end
|
240
|
-
|
241
|
-
|
242
|
-
it "rake jasmine:ci runs and returns expected results", :focus do
|
243
|
-
Bundler.with_clean_env do
|
244
|
-
`bundle add chrome_remote`
|
213
|
+
shared_examples_for 'a working jasmine:ci' do
|
214
|
+
it "rake jasmine:ci runs and returns expected results" do
|
215
|
+
Bundler.with_unbundled_env do
|
245
216
|
output = `bundle exec rake jasmine:ci`
|
246
217
|
expect(output).to include('5 specs, 0 failures')
|
247
|
-
|
218
|
+
expect($?).to be_success
|
248
219
|
end
|
249
220
|
end
|
250
221
|
|
251
222
|
it "rake jasmine:ci returns proper exit code when specs fail" do
|
252
|
-
Bundler.
|
253
|
-
`bundle add chrome_remote`
|
254
|
-
|
223
|
+
Bundler.with_unbundled_env do
|
255
224
|
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'failing_test.js'), File.join('spec', 'javascripts'))
|
256
225
|
failing_yaml = custom_jasmine_config('failing') do |jasmine_config|
|
257
226
|
jasmine_config['spec_files'] << 'failing_test.js'
|
@@ -259,13 +228,11 @@ if rails_available?
|
|
259
228
|
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{failing_yaml}`
|
260
229
|
expect($?).to_not be_success
|
261
230
|
expect(output).to include('6 specs, 1 failure')
|
262
|
-
`bundle remove chrome_remote`
|
263
231
|
end
|
264
232
|
end
|
265
233
|
|
266
234
|
it "rake jasmine:ci runs specs when an error occurs in the javascript" do
|
267
|
-
Bundler.
|
268
|
-
`bundle add chrome_remote`
|
235
|
+
Bundler.with_unbundled_env do
|
269
236
|
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'exception_test.js'), File.join('spec', 'javascripts'))
|
270
237
|
exception_yaml = custom_jasmine_config('exception') do |jasmine_config|
|
271
238
|
jasmine_config['spec_files'] << 'exception_test.js'
|
@@ -273,27 +240,51 @@ if rails_available?
|
|
273
240
|
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{exception_yaml}`
|
274
241
|
expect($?).to_not be_success
|
275
242
|
expect(output).to include('5 specs, 0 failures')
|
276
|
-
`bundle remove chrome_remote`
|
277
243
|
end
|
278
244
|
end
|
279
245
|
|
280
|
-
|
281
|
-
|
282
|
-
|
246
|
+
unless rails_version == 'rails6'
|
247
|
+
it "runs specs written in coffeescript" do
|
248
|
+
coffee_yaml = custom_jasmine_config('coffee') do |jasmine_config|
|
249
|
+
jasmine_config['spec_files'] << 'coffee_spec.coffee'
|
250
|
+
end
|
251
|
+
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'coffee_spec.coffee'), File.join('spec', 'javascripts'))
|
252
|
+
|
253
|
+
Bundler.with_unbundled_env do
|
254
|
+
output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{coffee_yaml}`
|
255
|
+
expect(output).to include('6 specs, 0 failures')
|
256
|
+
expect($?).to be_success
|
257
|
+
end
|
283
258
|
end
|
284
|
-
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
describe "with phantomJS" do
|
263
|
+
it_behaves_like 'a working jasmine:ci'
|
264
|
+
end
|
285
265
|
|
286
|
-
|
266
|
+
describe "with Chrome headless" do
|
267
|
+
before :all do
|
268
|
+
open('spec/javascripts/support/jasmine_helper.rb', 'w') { |f|
|
269
|
+
f.puts "Jasmine.configure do |config|\n config.runner_browser = :chromeheadless\nend\n"
|
270
|
+
f.flush
|
271
|
+
}
|
272
|
+
Bundler.with_unbundled_env do
|
287
273
|
`bundle add chrome_remote`
|
288
|
-
|
289
|
-
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
after :all do
|
278
|
+
Bundler.with_unbundled_env do
|
290
279
|
`bundle remove chrome_remote`
|
291
280
|
end
|
292
281
|
end
|
282
|
+
|
283
|
+
it_behaves_like 'a working jasmine:ci'
|
293
284
|
end
|
294
285
|
|
295
286
|
def run_jasmine_server(options = "")
|
296
|
-
Bundler.
|
287
|
+
Bundler.with_unbundled_env do
|
297
288
|
begin
|
298
289
|
pid = IO.popen("bundle exec rake jasmine #{options}").pid
|
299
290
|
Jasmine::wait_for_listener(8888, 'localhost', 60)
|
data/spec/spec_helper.rb
CHANGED
@@ -21,6 +21,27 @@ rescue Gem::LoadError
|
|
21
21
|
false
|
22
22
|
end
|
23
23
|
|
24
|
+
def rails_version
|
25
|
+
if ENV['RAILS_VERSION']
|
26
|
+
ENV['RAILS_VERSION']
|
27
|
+
else
|
28
|
+
'rails6' # keep in sync with default in gemspec
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def ruby_at_least?(version_str)
|
33
|
+
desired = version_str.split('.').map(&:to_i)
|
34
|
+
actual = RUBY_VERSION.split('.').map(&:to_i)
|
35
|
+
|
36
|
+
desired.zip(actual).each do |(d, a)|
|
37
|
+
if d != a
|
38
|
+
return d <= a
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
true
|
43
|
+
end
|
44
|
+
|
24
45
|
def create_temp_dir
|
25
46
|
tmp = File.join(Dir.tmpdir, "jasmine-gem-test_#{Time.now.to_f}")
|
26
47
|
FileUtils.rm_r(tmp, :force => true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Van Hove
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -17,6 +17,9 @@ dependencies:
|
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 6.0.0
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -24,6 +27,9 @@ dependencies:
|
|
24
27
|
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '5'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 6.0.0
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rack-test
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,6 +214,7 @@ files:
|
|
208
214
|
- release_notes/3.3.0.md
|
209
215
|
- release_notes/3.4.0.md
|
210
216
|
- release_notes/3.5.0.md
|
217
|
+
- release_notes/3.5.1.md
|
211
218
|
- release_notes/v1.2.1.md
|
212
219
|
- release_notes/v1.3.2.md
|
213
220
|
- release_notes/v2.0.0.md
|
@@ -283,7 +290,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
283
290
|
version: '0'
|
284
291
|
requirements: []
|
285
292
|
rubyforge_project:
|
286
|
-
rubygems_version: 2.6.
|
293
|
+
rubygems_version: 2.7.6.2
|
287
294
|
signing_key:
|
288
295
|
specification_version: 4
|
289
296
|
summary: JavaScript BDD framework
|