jasmine 2.0.2 → 2.0.3
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.
- checksums.yaml +4 -4
- data/README.markdown +6 -4
- data/lib/generators/jasmine/install/templates/spec/javascripts/support/jasmine_helper.rb +1 -1
- data/lib/jasmine/asset_expander.rb +2 -2
- data/lib/jasmine/base.rb +1 -1
- data/lib/jasmine/config.rb +11 -1
- data/lib/jasmine/configuration.rb +4 -0
- data/lib/jasmine/runners/phantom_jasmine_run.js +18 -0
- data/lib/jasmine/runners/phantom_js.rb +16 -4
- data/lib/jasmine/tasks/jasmine.rake +1 -1
- data/lib/jasmine/version.rb +1 -1
- data/lib/jasmine/yaml_config_parser.rb +9 -0
- data/release_notes/v2.0.1.md +31 -0
- data/release_notes/v2.0.2.md +17 -0
- data/release_notes/v2.0.3.md +31 -0
- data/spec/application_spec.rb +9 -3
- data/spec/fixture/console_log_spec.js +5 -0
- data/spec/fixture/phantomConfig.js +6 -0
- data/spec/fixture/viewport_spec.js +6 -0
- data/spec/jasmine_pojs_spec.rb +40 -0
- data/spec/jasmine_rails_spec.rb +49 -37
- data/spec/spec_helper.rb +0 -4
- metadata +12 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 802718348ddd679b80993ea341baa900a242a88a
|
4
|
+
data.tar.gz: 1c111697927bcdda6dcde1ed52017c062680a8ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dab4e334f2286eff80cc75e8bdce6b60d3a8377bc159e2266c197807c75fa561fb2c15c7198ad05fb6bf359a3322b60bfa52effd1a378ece4b2aa4be271ce51
|
7
|
+
data.tar.gz: 1d07d043a1d1a686e8b0f2e0dc3e97837278b99417449bbd40efb3fe65006c44a54addf378af1728abee52b1c8ebd839d90cf6cff67e2c90e9b6251f5619d10e
|
data/README.markdown
CHANGED
@@ -21,13 +21,15 @@ end
|
|
21
21
|
|
22
22
|
To initialize a project for Jasmine
|
23
23
|
|
24
|
-
|
25
|
-
|
24
|
+
rails g jasmine:install
|
25
|
+
|
26
|
+
rails g jasmine:examples
|
26
27
|
|
27
28
|
For any other project (Sinatra, Merb, or something we don't yet know about) use
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
jasmine init
|
31
|
+
|
32
|
+
jasmine examples
|
31
33
|
|
32
34
|
## Usage
|
33
35
|
|
@@ -54,9 +54,9 @@ module Jasmine
|
|
54
54
|
assets_environment.find_asset(pathname).to_a.map do |processed_asset|
|
55
55
|
case processed_asset.content_type
|
56
56
|
when "text/css"
|
57
|
-
path_to_stylesheet(processed_asset.logical_path)
|
57
|
+
path_to_stylesheet(processed_asset.logical_path, debug: true)
|
58
58
|
when "application/javascript"
|
59
|
-
path_to_javascript(processed_asset.logical_path)
|
59
|
+
path_to_javascript(processed_asset.logical_path, debug: true)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
data/lib/jasmine/base.rb
CHANGED
data/lib/jasmine/config.rb
CHANGED
@@ -66,6 +66,7 @@ module Jasmine
|
|
66
66
|
end
|
67
67
|
if Jasmine::Dependencies.rails4?
|
68
68
|
include ::Sprockets::Rails::Helper
|
69
|
+
Rails.application.assets.context_class.assets_prefix = Rails.application.config.assets.prefix
|
69
70
|
end
|
70
71
|
end
|
71
72
|
@config.add_rack_path(Rails.application.config.assets.prefix, lambda {
|
@@ -73,7 +74,13 @@ module Jasmine
|
|
73
74
|
})
|
74
75
|
end
|
75
76
|
|
76
|
-
@config.runner = lambda
|
77
|
+
@config.runner = lambda do |formatter, jasmine_server_url|
|
78
|
+
Jasmine::Runners::PhantomJs.new(formatter,
|
79
|
+
jasmine_server_url,
|
80
|
+
@config.prevent_phantom_js_auto_install,
|
81
|
+
@config.show_console_log,
|
82
|
+
@config.phantom_config_script)
|
83
|
+
end
|
77
84
|
end
|
78
85
|
|
79
86
|
def self.config
|
@@ -102,6 +109,9 @@ module Jasmine
|
|
102
109
|
config.spec_dir = yaml_config.spec_dir
|
103
110
|
config.spec_files = lambda { yaml_config.helpers + yaml_config.spec_files }
|
104
111
|
|
112
|
+
config.show_console_log = yaml_config.show_console_log
|
113
|
+
config.phantom_config_script = yaml_config.phantom_config_script
|
114
|
+
|
105
115
|
config.rack_options = yaml_config.rack_options
|
106
116
|
end
|
107
117
|
require yaml_config.spec_helper if File.exist?(yaml_config.spec_helper)
|
@@ -10,6 +10,8 @@ module Jasmine
|
|
10
10
|
attr_accessor :runner
|
11
11
|
attr_accessor :rack_options
|
12
12
|
attr_accessor :prevent_phantom_js_auto_install
|
13
|
+
attr_accessor :show_console_log
|
14
|
+
attr_accessor :phantom_config_script
|
13
15
|
attr_reader :rack_apps
|
14
16
|
|
15
17
|
def initialize()
|
@@ -25,6 +27,8 @@ module Jasmine
|
|
25
27
|
@spec_files = lambda { [] }
|
26
28
|
@runner = lambda { |config| }
|
27
29
|
@rack_options = {}
|
30
|
+
@show_console_log = false
|
31
|
+
@phantom_config_script = nil
|
28
32
|
|
29
33
|
@formatters = [Jasmine::Formatters::Console]
|
30
34
|
|
@@ -1,7 +1,19 @@
|
|
1
1
|
(function() {
|
2
2
|
var url = phantom.args[0];
|
3
|
+
var showConsoleLog = phantom.args[1] === 'true';
|
4
|
+
var configScript = phantom.args[2];
|
3
5
|
var page = require('webpage').create();
|
4
6
|
|
7
|
+
if (configScript !== '') {
|
8
|
+
try {
|
9
|
+
require(configScript).configure(page);
|
10
|
+
} catch(e) {
|
11
|
+
console.error('Failed to configure phantom');
|
12
|
+
console.error(e.stack);
|
13
|
+
phantom.exit(1);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
5
17
|
page.onCallback = function(data) {
|
6
18
|
if(data.state === 'specDone') {
|
7
19
|
console.log('jasmine_result' + JSON.stringify([].concat(data.results)));
|
@@ -10,6 +22,12 @@
|
|
10
22
|
}
|
11
23
|
};
|
12
24
|
|
25
|
+
if (showConsoleLog) {
|
26
|
+
page.onConsoleMessage = function(message) {
|
27
|
+
console.log(message);
|
28
|
+
};
|
29
|
+
}
|
30
|
+
|
13
31
|
page.open(url, function(status) {
|
14
32
|
if (status !== "success") {
|
15
33
|
phantom.exit(1);
|
@@ -3,15 +3,17 @@ require 'phantomjs'
|
|
3
3
|
module Jasmine
|
4
4
|
module Runners
|
5
5
|
class PhantomJs
|
6
|
-
def initialize(formatter, jasmine_server_url,
|
6
|
+
def initialize(formatter, jasmine_server_url, prevent_phantom_js_auto_install, show_console_log, phantom_config_script)
|
7
7
|
@formatter = formatter
|
8
8
|
@jasmine_server_url = jasmine_server_url
|
9
|
-
@result_batch_size = result_batch_size
|
10
9
|
@prevent_phantom_js_auto_install = prevent_phantom_js_auto_install
|
10
|
+
@show_console_log = show_console_log
|
11
|
+
@phantom_config_script = phantom_config_script
|
11
12
|
end
|
12
13
|
|
13
14
|
def run
|
14
|
-
|
15
|
+
phantom_script = File.join(File.dirname(__FILE__), 'phantom_jasmine_run.js')
|
16
|
+
command = "#{phantom_js_path} '#{phantom_script}' #{jasmine_server_url} #{show_console_log} '#{@phantom_config_script}'"
|
15
17
|
IO.popen(command) do |output|
|
16
18
|
output.each do |line|
|
17
19
|
if line =~ /^jasmine_result/
|
@@ -19,6 +21,16 @@ module Jasmine
|
|
19
21
|
raw_results = JSON.parse(line, :max_nesting => false)
|
20
22
|
results = raw_results.map { |r| Result.new(r) }
|
21
23
|
formatter.format(results)
|
24
|
+
elsif line =~ /^Failed to configure phantom$/
|
25
|
+
config_failure = Result.new('fullName' => line,
|
26
|
+
'failedExpectations' => [],
|
27
|
+
'description' => '',
|
28
|
+
'status' => 'failed')
|
29
|
+
formatter.format([config_failure])
|
30
|
+
@show_console_log = true
|
31
|
+
puts line
|
32
|
+
elsif show_console_log
|
33
|
+
puts line
|
22
34
|
end
|
23
35
|
end
|
24
36
|
end
|
@@ -34,7 +46,7 @@ module Jasmine
|
|
34
46
|
end
|
35
47
|
|
36
48
|
private
|
37
|
-
attr_reader :formatter, :jasmine_server_url, :
|
49
|
+
attr_reader :formatter, :jasmine_server_url, :prevent_phantom_js_auto_install, :show_console_log
|
38
50
|
end
|
39
51
|
end
|
40
52
|
end
|
data/lib/jasmine/version.rb
CHANGED
@@ -59,6 +59,15 @@ module Jasmine
|
|
59
59
|
File.join(@pwd, loaded_yaml['spec_helper'] || File.join('spec', 'javascripts', 'support', 'jasmine_helper.rb'))
|
60
60
|
end
|
61
61
|
|
62
|
+
def show_console_log
|
63
|
+
loaded_yaml['show_console_log'] || false
|
64
|
+
end
|
65
|
+
|
66
|
+
def phantom_config_script
|
67
|
+
return nil unless loaded_yaml['phantom_config_script']
|
68
|
+
File.join @pwd, loaded_yaml['phantom_config_script']
|
69
|
+
end
|
70
|
+
|
62
71
|
def rack_options
|
63
72
|
loaded_yaml.fetch('rack_options', {}).inject({}) do |memo, (key, value)|
|
64
73
|
memo[key.to_sym] = value
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Jasmine Gem 2.0.1 Release Notes
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
|
5
|
+
This is a minor release with some updates to allow more configuration and support for Rails 4.1
|
6
|
+
|
7
|
+
## Changes
|
8
|
+
|
9
|
+
* No longer try to save `jasmine:ci` from bad server exits
|
10
|
+
* Print help when no argument is passed to command line tool
|
11
|
+
* Add a hook for plugins to configure themselves after jasmine has loaded the default configuration.
|
12
|
+
* default stylesheets for rails use assets/application.css
|
13
|
+
* Allow rack apps to have configuration other than blocks
|
14
|
+
* support http sources for pulling js/css from a CDN
|
15
|
+
* Allow custom rack options to be passed when starting jasmine server
|
16
|
+
|
17
|
+
## Fixes
|
18
|
+
|
19
|
+
* Allow all versions of rails 4
|
20
|
+
* don't use thin in jruby
|
21
|
+
|
22
|
+
## Accepted Pull Requests
|
23
|
+
|
24
|
+
* Fix the method that checks whether jasmine server is running #[196](http://github.com/pivotal/jasmine-gem/pull/196)
|
25
|
+
* streaming ouput for phantom runner in jasmine:ci #[190](http://github.com/pivotal/jasmine-gem/pull/190)
|
26
|
+
* Fix rails generator help message. #[189](http://github.com/pivotal/jasmine-gem/pull/189)
|
27
|
+
* Update railtie to support Rails 4.1 #[186](http://github.com/pivotal/jasmine-gem/pull/186)
|
28
|
+
|
29
|
+
------
|
30
|
+
|
31
|
+
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Jasmine Gem 2.0.2 Release Notes
|
2
|
+
|
3
|
+
## Summary
|
4
|
+
|
5
|
+
This is a minor release primarily allowing the phantom js download to be skipped
|
6
|
+
|
7
|
+
## Accepted Pull Requests
|
8
|
+
|
9
|
+
* Allow prevention of PhantomJS download #[213](http://github.com/pivotal/jasmine-gem/pull/213)
|
10
|
+
* Add Ruby 2.1.1 to Travis build #[212](http://github.com/pivotal/jasmine-gem/pull/212)
|
11
|
+
* Add Rails asset pipeline directories to spec pipeline #[211](http://github.com/pivotal/jasmine-gem/pull/211)
|
12
|
+
* Refactor Asset Pipeline handling. #[210](http://github.com/pivotal/jasmine-gem/pull/210)
|
13
|
+
* Try to ensure that rake tasks are only loaded once #[206](http://github.com/pivotal/jasmine-gem/pull/206)
|
14
|
+
|
15
|
+
------
|
16
|
+
|
17
|
+
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Jasmine Gem 2.0.3 Release Notes
|
2
|
+
|
3
|
+
These notes cover version 2.0.3
|
4
|
+
|
5
|
+
## Summary
|
6
|
+
|
7
|
+
This is primarily a bugfix release.
|
8
|
+
|
9
|
+
## Changes
|
10
|
+
|
11
|
+
* puts console.log messages from the browser.
|
12
|
+
* Allow a script to be called to configure the phantom webpage object
|
13
|
+
|
14
|
+
## Fixes
|
15
|
+
|
16
|
+
* Tell sprockets we're in debug mode when requiring individual assets #[228](http://github.com/pivotal/jasmine-gem/issues/228)
|
17
|
+
* Use `exit` instead of `break` #[223](http://github.com/pivotal/jasmine-gem/issues/223)
|
18
|
+
|
19
|
+
## Accepted Pull Requests
|
20
|
+
|
21
|
+
* Catching error when ipv6 is off #[227](http://github.com/pivotal/jasmine-gem/pull/227)
|
22
|
+
* Display separate commands on separate lines in the README #[224](http://github.com/pivotal/jasmine-gem/pull/224)
|
23
|
+
* Remove test app dependencies #[220](http://github.com/pivotal/jasmine-gem/pull/220)
|
24
|
+
* Fix rubinius test failures #[219](http://github.com/pivotal/jasmine-gem/pull/219)
|
25
|
+
* Set assets prefix in assets context #[216](http://github.com/pivotal/jasmine-gem/pull/216)
|
26
|
+
* Fix for tests that failed after dependency behavior changed. #[218](http://github.com/pivotal/jasmine-gem/pull/218)
|
27
|
+
* Fix config option typo in jasmine helper #[215](http://github.com/pivotal/jasmine-gem/pull/215)
|
28
|
+
|
29
|
+
------
|
30
|
+
|
31
|
+
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
|
data/spec/application_spec.rb
CHANGED
@@ -36,13 +36,19 @@ describe 'Jasmine::Application' do
|
|
36
36
|
config = double(:config, :rack_path_map => [], :rack_apps => [
|
37
37
|
{ :app => app1 },
|
38
38
|
{ :app => app2, :block => block },
|
39
|
-
{ :app => app3, :args => [:foo], :block => block },
|
39
|
+
{ :app => app3, :args => [:foo, :bar], :block => block },
|
40
40
|
{ :app => app4, :args => [:bar] }
|
41
41
|
])
|
42
42
|
builder = double('Rack::Builder.new')
|
43
43
|
builder.should_receive(:use).with(app1)
|
44
|
-
builder.should_receive(:use)
|
45
|
-
|
44
|
+
builder.should_receive(:use) do |*args, &arg_block|
|
45
|
+
args.should == [app2]
|
46
|
+
arg_block.should == block
|
47
|
+
end
|
48
|
+
builder.should_receive(:use) do |*args, &arg_block|
|
49
|
+
args.should == [app3, :foo, :bar]
|
50
|
+
arg_block.should == block
|
51
|
+
end
|
46
52
|
builder.should_receive(:use).with(app4, :bar)
|
47
53
|
Jasmine::Application.app(config, builder).should == builder
|
48
54
|
end
|
data/spec/jasmine_pojs_spec.rb
CHANGED
@@ -60,4 +60,44 @@ describe "POJS jasmine install" do
|
|
60
60
|
`rake jasmine:ci JASMINE_CONFIG_PATH=#{failing_yaml}`
|
61
61
|
$?.should_not be_success
|
62
62
|
end
|
63
|
+
|
64
|
+
context 'with a spec with a console.log' do
|
65
|
+
before do
|
66
|
+
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'console_log_spec.js'), File.join('spec', 'javascripts'))
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'hides console.log by default' do
|
70
|
+
output = `rake jasmine:ci`
|
71
|
+
output.should_not include("I'm in the webpage!")
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'can be told to show console.log' do
|
75
|
+
log_yaml = custom_jasmine_config('log') do |jasmine_config|
|
76
|
+
jasmine_config['show_console_log'] = true
|
77
|
+
end
|
78
|
+
output = `rake jasmine:ci JASMINE_CONFIG_PATH=#{log_yaml}`
|
79
|
+
output.should include("I'm in the webpage!")
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'should allow customizing the phantom page' do
|
84
|
+
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'viewport_spec.js'), File.join('spec', 'javascripts'))
|
85
|
+
FileUtils.cp(File.join(@root, 'spec', 'fixture', 'phantomConfig.js'), File.join('spec', 'javascripts', 'support'))
|
86
|
+
viewport_yaml = custom_jasmine_config('viewport') do |jasmine_config|
|
87
|
+
jasmine_config['phantom_config_script'] = 'spec/javascripts/support/phantomConfig.js'
|
88
|
+
end
|
89
|
+
|
90
|
+
output = `rake jasmine:ci JASMINE_CONFIG_PATH=#{viewport_yaml}`
|
91
|
+
output.should =~ /[1-9]\d* specs, 0 failures/
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should throw a useful error when the phantom customization fails' do
|
95
|
+
bad_phantom_yaml = custom_jasmine_config('viewport') do |jasmine_config|
|
96
|
+
jasmine_config['phantom_config_script'] = 'spec/javascripts/support/doesNotExist.js'
|
97
|
+
end
|
98
|
+
|
99
|
+
output = `rake jasmine:ci JASMINE_CONFIG_PATH=#{bad_phantom_yaml}`
|
100
|
+
$?.should_not be_success
|
101
|
+
output.should =~ /Failed to configure phantom/
|
102
|
+
end
|
63
103
|
end
|
data/spec/jasmine_rails_spec.rb
CHANGED
@@ -21,23 +21,20 @@ if Jasmine::Dependencies.rails_available?
|
|
21
21
|
temp_dir_before
|
22
22
|
Dir::chdir @tmp
|
23
23
|
|
24
|
-
|
24
|
+
`rails new rails-example --skip-bundle --skip-active-record`
|
25
25
|
Dir::chdir File.join(@tmp, 'rails-example')
|
26
26
|
|
27
27
|
base = File.absolute_path(File.join(__FILE__, '../..'))
|
28
28
|
|
29
|
-
#
|
30
|
-
# see
|
31
|
-
file_contents = File.read('Gemfile')
|
29
|
+
# execjs v2.2.0 is broken in rbx, locking the version to 2.0.2 for now
|
30
|
+
# see https://github.com/sstephenson/execjs/issues/148
|
32
31
|
|
33
|
-
open('Gemfile', '
|
34
|
-
f.puts file_contents.sub("gem 'sqlite3'", "gem 'sqlite3', '1.3.8'")
|
32
|
+
open('Gemfile', 'a') { |f|
|
35
33
|
f.puts "gem 'jasmine', :path => '#{base}'"
|
36
34
|
f.puts "gem 'jasmine-core', :github => 'pivotal/jasmine'"
|
37
|
-
f.puts "gem 'rubysl', :platform => :rbx"
|
38
|
-
f.puts "gem 'racc', :platform => :rbx"
|
39
35
|
f.puts "gem 'thin'" unless RUBY_PLATFORM == 'java'
|
40
36
|
f.puts "gem 'angularjs-rails'"
|
37
|
+
f.puts "gem 'execjs', '2.0.2'"
|
41
38
|
f.flush
|
42
39
|
}
|
43
40
|
|
@@ -61,7 +58,6 @@ if Jasmine::Dependencies.rails_available?
|
|
61
58
|
it 'should have the jasmine & jasmine:ci rake task' do
|
62
59
|
#See https://github.com/jimweirich/rake/issues/220 and https://github.com/jruby/activerecord-jdbc-adapter/pull/467
|
63
60
|
#There's a workaround, but requires setting env vars & jruby opts (non-trivial when inside of a jruby process), so skip for now.
|
64
|
-
pending "activerecord-jdbc + rake -T doesn't work correctly under Jruby" if ENV['RAILS_VERSION'] == 'rails3' && RUBY_PLATFORM == 'java'
|
65
61
|
Bundler.with_clean_env do
|
66
62
|
output = `bundle exec rake -T`
|
67
63
|
output.should include('jasmine ')
|
@@ -128,37 +124,28 @@ if Jasmine::Dependencies.rails_available?
|
|
128
124
|
jasmine_config['stylesheets'] = ['assets/application.css']
|
129
125
|
end
|
130
126
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
127
|
+
run_jasmine_server("JASMINE_CONFIG_PATH=#{css_yaml}") do
|
128
|
+
output = Net::HTTP.get(URI.parse('http://localhost:8888/'))
|
129
|
+
output.should match(%r{script src.*/assets/jasmine_examples/Player\.js})
|
130
|
+
output.should match(%r{script src=['"]http://ajax\.googleapis\.com/ajax/libs/jquery/1\.11\.0/jquery\.min\.js})
|
131
|
+
output.should match(%r{script src.*/assets/jasmine_examples/Song\.js})
|
132
|
+
output.should match(%r{script src.*angular_helper\.js})
|
133
|
+
output.should match(%r{<link rel=.stylesheet.*?href=./assets/foo\.css\?.*?>})
|
135
134
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
`kill -0 #{pid}`
|
141
|
-
unless $?.success?
|
142
|
-
puts "someone else is running a server on port 8888"
|
143
|
-
$?.should be_success
|
144
|
-
end
|
135
|
+
output = Net::HTTP.get(URI.parse('http://localhost:8888/__spec__/helpers/angular_helper.js'))
|
136
|
+
output.should match(/angular\.mock/)
|
137
|
+
end
|
138
|
+
end
|
145
139
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
output.should match(%r{<link rel=.stylesheet.*?href=./assets/foo\.css\?.*?>})
|
140
|
+
it "sets assets_prefix when using sprockets" do
|
141
|
+
open('app/assets/stylesheets/assets_prefix.js.erb', 'w') { |f|
|
142
|
+
f.puts "<%= assets_prefix %>"
|
143
|
+
f.flush
|
144
|
+
}
|
152
145
|
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
Process.kill(:SIGINT, pid)
|
157
|
-
begin
|
158
|
-
Process.waitpid pid
|
159
|
-
rescue Errno::ECHILD
|
160
|
-
end
|
161
|
-
end
|
146
|
+
run_jasmine_server do
|
147
|
+
output = Net::HTTP.get(URI.parse('http://localhost:8888/assets/assets_prefix.js'))
|
148
|
+
output.should match("/assets")
|
162
149
|
end
|
163
150
|
end
|
164
151
|
|
@@ -191,5 +178,30 @@ if Jasmine::Dependencies.rails_available?
|
|
191
178
|
custom_output.should include("WEBrick")
|
192
179
|
end
|
193
180
|
end
|
181
|
+
|
182
|
+
def run_jasmine_server(options = "")
|
183
|
+
Bundler.with_clean_env do
|
184
|
+
begin
|
185
|
+
pid = IO.popen("bundle exec rake jasmine #{options}").pid
|
186
|
+
Jasmine::wait_for_listener(8888, 'jasmine server', 60)
|
187
|
+
|
188
|
+
# if the process we started is not still running, it's very likely this test
|
189
|
+
# will fail because another server is already running on port 8888
|
190
|
+
# (kill -0 will check if you can send *ANY* signal to this process)
|
191
|
+
# (( it does not actually kill the process, that happens below))
|
192
|
+
`kill -0 #{pid}`
|
193
|
+
unless $?.success?
|
194
|
+
puts "someone else is running a server on port 8888"
|
195
|
+
$?.should be_success
|
196
|
+
end
|
197
|
+
ensure
|
198
|
+
Process.kill(:SIGINT, pid)
|
199
|
+
begin
|
200
|
+
Process.waitpid pid
|
201
|
+
rescue Errno::ECHILD
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
194
206
|
end
|
195
207
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -11,10 +11,6 @@ $:.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}`
|
16
|
-
end
|
17
|
-
|
18
14
|
def create_temp_dir
|
19
15
|
tmp = File.join(Dir.tmpdir, "jasmine-gem-test_#{Time.now.to_f}")
|
20
16
|
FileUtils.rm_r(tmp, :force => true)
|
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: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajan Agaskar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -202,18 +202,24 @@ files:
|
|
202
202
|
- release_notes/v1.2.1.md
|
203
203
|
- release_notes/v1.3.2.md
|
204
204
|
- release_notes/v2.0.0.md
|
205
|
+
- release_notes/v2.0.1.md
|
206
|
+
- release_notes/v2.0.2.md
|
207
|
+
- release_notes/v2.0.3.md
|
205
208
|
- spec/application_integration_spec.rb
|
206
209
|
- spec/application_spec.rb
|
207
210
|
- spec/base_spec.rb
|
208
211
|
- spec/configuration_spec.rb
|
209
212
|
- spec/fixture/Rakefile
|
210
213
|
- spec/fixture/coffee_spec.coffee
|
214
|
+
- spec/fixture/console_log_spec.js
|
211
215
|
- spec/fixture/exception_test.js
|
212
216
|
- spec/fixture/failing_runner.rb
|
213
217
|
- spec/fixture/failing_test.js
|
214
218
|
- spec/fixture/large_test_suite_spec.js
|
215
219
|
- spec/fixture/non_asset_pipeline.js
|
216
220
|
- spec/fixture/non_asset_pipeline_test.js
|
221
|
+
- spec/fixture/phantomConfig.js
|
222
|
+
- spec/fixture/viewport_spec.js
|
217
223
|
- spec/jasmine_command_line_tool_spec.rb
|
218
224
|
- spec/jasmine_pojs_spec.rb
|
219
225
|
- spec/jasmine_rails_spec.rb
|
@@ -249,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
249
255
|
version: '0'
|
250
256
|
requirements: []
|
251
257
|
rubyforge_project:
|
252
|
-
rubygems_version: 2.
|
258
|
+
rubygems_version: 2.0.3
|
253
259
|
signing_key:
|
254
260
|
specification_version: 4
|
255
261
|
summary: JavaScript BDD framework
|
@@ -260,12 +266,15 @@ test_files:
|
|
260
266
|
- spec/configuration_spec.rb
|
261
267
|
- spec/fixture/Rakefile
|
262
268
|
- spec/fixture/coffee_spec.coffee
|
269
|
+
- spec/fixture/console_log_spec.js
|
263
270
|
- spec/fixture/exception_test.js
|
264
271
|
- spec/fixture/failing_runner.rb
|
265
272
|
- spec/fixture/failing_test.js
|
266
273
|
- spec/fixture/large_test_suite_spec.js
|
267
274
|
- spec/fixture/non_asset_pipeline.js
|
268
275
|
- spec/fixture/non_asset_pipeline_test.js
|
276
|
+
- spec/fixture/phantomConfig.js
|
277
|
+
- spec/fixture/viewport_spec.js
|
269
278
|
- spec/jasmine_command_line_tool_spec.rb
|
270
279
|
- spec/jasmine_pojs_spec.rb
|
271
280
|
- spec/jasmine_rails_spec.rb
|