guard-jasmine 1.12.2 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,8 +67,25 @@ page.open options.url, (status) ->
67
67
  console.log JSON.stringify({ error: "Unable to access Jasmine specs at #{ options.url }" })
68
68
  phantom.exit()
69
69
  else
70
- done = -> phantom.exit()
71
- waitFor specsReady, done, options.timeout
70
+ runnerAvailable = page.evaluate -> window.jasmine
71
+
72
+ if runnerAvailable
73
+ done = -> phantom.exit()
74
+ waitFor specsReady, done, options.timeout
75
+ else
76
+ text = page.evaluate -> document.getElementsByTagName('body')[0]?.innerText
77
+
78
+ if text
79
+ error = """
80
+ The Jasmine reporter is not available!
81
+
82
+ #{ text }
83
+ """
84
+ console.log JSON.stringify({ error: error })
85
+ else
86
+ console.log JSON.stringify({ error: 'The Jasmine reporter is not available!' })
87
+
88
+ phantom.exit(1)
72
89
 
73
90
  # Test if the specs have finished.
74
91
  #
@@ -63,7 +63,7 @@
63
63
  };
64
64
 
65
65
  page.open(options.url, function(status) {
66
- var done;
66
+ var done, error, runnerAvailable, text;
67
67
  page.onLoadFinished = function() {};
68
68
  if (status !== 'success') {
69
69
  console.log(JSON.stringify({
@@ -71,10 +71,31 @@
71
71
  }));
72
72
  return phantom.exit();
73
73
  } else {
74
- done = function() {
75
- return phantom.exit();
76
- };
77
- return waitFor(specsReady, done, options.timeout);
74
+ runnerAvailable = page.evaluate(function() {
75
+ return window.jasmine;
76
+ });
77
+ if (runnerAvailable) {
78
+ done = function() {
79
+ return phantom.exit();
80
+ };
81
+ return waitFor(specsReady, done, options.timeout);
82
+ } else {
83
+ text = page.evaluate(function() {
84
+ var _ref;
85
+ return (_ref = document.getElementsByTagName('body')[0]) != null ? _ref.innerText : void 0;
86
+ });
87
+ if (text) {
88
+ error = "The Jasmine reporter is not available!\n\n" + text;
89
+ console.log(JSON.stringify({
90
+ error: error
91
+ }));
92
+ } else {
93
+ console.log(JSON.stringify({
94
+ error: 'The Jasmine reporter is not available!'
95
+ }));
96
+ }
97
+ return phantom.exit(1);
98
+ }
78
99
  }
79
100
  });
80
101
 
@@ -1,5 +1,6 @@
1
1
  guard :jasmine do
2
2
  watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$}) { 'spec/javascripts' }
3
3
  watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
4
+ watch(%r{spec/javascripts/fixtures/.+$})
4
5
  watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)(?:\.\w+)*$}) { |m| "spec/javascripts/#{ m[1] }_spec.#{ m[2] }" }
5
6
  end
@@ -30,8 +30,10 @@ module Guard
30
30
  available = response.code.to_i == 200
31
31
 
32
32
  unless available
33
- ::Guard::Jasmine::Formatter.error "Jasmine test runner fails with response code #{ response.code }"
34
- ::Guard::Jasmine::Formatter.error(response.body) if response.body
33
+ ::Guard::Jasmine::Formatter.error "Jasmine test runner failed with status #{ response.code }"
34
+ if response.body
35
+ ::Guard::Jasmine::Formatter.error 'Please open the Jasmine runner in your browser for more information.'
36
+ end
35
37
  end
36
38
 
37
39
  available
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  module JasmineVersion
3
3
  # Guard::Jasmine version that is used for the Gem specification
4
- VERSION = '1.12.2'
4
+ VERSION = '1.13.0'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-jasmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.2
4
+ version: 1.13.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-04 00:00:00.000000000 Z
12
+ date: 2013-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: guard
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  version: 1.3.6
147
147
  requirements: []
148
148
  rubyforge_project: guard-jasmine
149
- rubygems_version: 1.8.25
149
+ rubygems_version: 1.8.24
150
150
  signing_key:
151
151
  specification_version: 3
152
152
  summary: Guard gem for headless testing with Jasmine