@@ -210,11 +210,12 @@ def bundle_install
210210 end
211211 end
212212
213- describe "with phantomJS" do
213+ shared_examples_for 'a working jasmine:ci' do
214214 it "rake jasmine:ci runs and returns expected results" do
215215 Bundler . with_unbundled_env do
216216 output = `bundle exec rake jasmine:ci`
217217 expect ( output ) . to include ( '5 specs, 0 failures' )
218+ expect ( $?) . to be_success
218219 end
219220 end
220221
@@ -252,11 +253,16 @@ def bundle_install
252253 Bundler . with_unbundled_env do
253254 output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{ coffee_yaml } `
254255 expect ( output ) . to include ( '6 specs, 0 failures' )
256+ expect ( $?) . to be_success
255257 end
256258 end
257259 end
258260 end
259261
262+ describe "with phantomJS" do
263+ it_behaves_like 'a working jasmine:ci'
264+ end
265+
260266 describe "with Chrome headless" do
261267 before :all do
262268 open ( 'spec/javascripts/support/jasmine_helper.rb' , 'w' ) { |f |
@@ -274,53 +280,7 @@ def bundle_install
274280 end
275281 end
276282
277-
278- it "rake jasmine:ci runs and returns expected results" do
279- Bundler . with_unbundled_env do
280- output = `bundle exec rake jasmine:ci`
281- expect ( output ) . to include ( '5 specs, 0 failures' )
282- expect ( $?) . to be_success
283- end
284- end
285-
286- it "rake jasmine:ci returns proper exit code when specs fail" do
287- Bundler . with_unbundled_env do
288- FileUtils . cp ( File . join ( @root , 'spec' , 'fixture' , 'failing_test.js' ) , File . join ( 'spec' , 'javascripts' ) )
289- failing_yaml = custom_jasmine_config ( 'failing' ) do |jasmine_config |
290- jasmine_config [ 'spec_files' ] << 'failing_test.js'
291- end
292- output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{ failing_yaml } `
293- expect ( $?) . to_not be_success
294- expect ( output ) . to include ( '6 specs, 1 failure' )
295- end
296- end
297-
298- it "rake jasmine:ci runs specs when an error occurs in the javascript" do
299- Bundler . with_unbundled_env do
300- FileUtils . cp ( File . join ( @root , 'spec' , 'fixture' , 'exception_test.js' ) , File . join ( 'spec' , 'javascripts' ) )
301- exception_yaml = custom_jasmine_config ( 'exception' ) do |jasmine_config |
302- jasmine_config [ 'spec_files' ] << 'exception_test.js'
303- end
304- output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{ exception_yaml } `
305- expect ( $?) . to_not be_success
306- expect ( output ) . to include ( '5 specs, 0 failures' )
307- end
308- end
309-
310- unless rails_version == 'rails6'
311- it "runs specs written in coffeescript" do
312- coffee_yaml = custom_jasmine_config ( 'coffee' ) do |jasmine_config |
313- jasmine_config [ 'spec_files' ] << 'coffee_spec.coffee'
314- end
315- FileUtils . cp ( File . join ( @root , 'spec' , 'fixture' , 'coffee_spec.coffee' ) , File . join ( 'spec' , 'javascripts' ) )
316-
317- Bundler . with_unbundled_env do
318- output = `bundle exec rake jasmine:ci JASMINE_CONFIG_PATH=#{ coffee_yaml } `
319- expect ( output ) . to include ( '6 specs, 0 failures' )
320- expect ( $?) . to be_success
321- end
322- end
323- end
283+ it_behaves_like 'a working jasmine:ci'
324284 end
325285
326286 def run_jasmine_server ( options = "" )
0 commit comments