jasmine-phantom 0.0.4 → 0.0.5

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.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (C) 2012 Flipstone Technology Partners, INC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
20
+
data/README.markdown CHANGED
@@ -1,18 +1,15 @@
1
1
  Jasmine Phantom
2
2
  ===============
3
3
 
4
- Jasmine Phantom provides a rake task that runs your jasmine specs via phantomjs. It is adapted from the jasmine runner example that comes with
5
- phantom js. It requires jasmine `>= 1.2.0rc2`, which is only currently available via GitHub.
4
+ Jasmine Phantom provides a rake task that runs your jasmine specs via phantomjs.
5
+ It requires jasmine >= 1.2.0.
6
6
 
7
7
  Installation
8
8
  ------------
9
9
 
10
- Add jasmine 1.2.0rc2 and jasmine-phantom to your gemfile:
11
-
12
- gem 'jasmine', '1.2.0.rc2',
13
- git: "git://github.com/pivotal/jasmine-gem.git",
14
- branch: "953d17dff4b4adba79b2a808b55cf33f4ff93af7"
10
+ Add jasmine 1.2.0 and jasmine-phantom to your gemfile:
15
11
 
12
+ gem 'jasmine', '1.2.0'
16
13
  gem 'jasmine-phantom'
17
14
 
18
15
 
@@ -7,6 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Jasmine::Phantom::VERSION
8
8
  s.authors = ["David Vollbracht"]
9
9
  s.email = ["david@flipstone.com"]
10
+ s.license = "MIT"
10
11
  s.homepage = "http://github.com/flipstone/jasmine-phantom"
11
12
  s.summary = %q{Run you jasmine specs from the commant line using phantomjs}
12
13
  s.description = %q{jasmine-phantom provides a rake task, jasmine:phantom:ci,
@@ -25,5 +26,5 @@ Gem::Specification.new do |s|
25
26
  # specify any dependencies here; for example:
26
27
  # s.add_development_dependency "rspec"
27
28
  s.add_runtime_dependency "rails", '>= 3.0'
28
- s.add_runtime_dependency "jasmine", '>= 1.2.0rc2'
29
+ s.add_runtime_dependency "jasmine", '>= 1.2.0'
29
30
  end
@@ -1,39 +1,3 @@
1
- var system = require('system');
2
-
3
- function waitFor(message, testFx, onReady, timeOutMillis) {
4
- var maxtimeOutMillis = timeOutMillis ? timeOutMillis : 3001; //< Default Max Timeout is 3s
5
- var start = new Date().getTime();
6
- var condition = false;
7
- var interval = setInterval(function() {
8
- if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) {
9
- // If not time-out yet and condition not yet fulfilled
10
- condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code
11
- } else {
12
- if(!condition) {
13
- // If condition still not fulfilled (timeout but condition is 'false')
14
- console.log("'Timed out waiting for " + message);
15
- phantom.exit(1);
16
- } else {
17
- // Condition fulfilled (timeout and/or condition is 'true')
18
- typeof(onReady) === "string" ? eval(onReady) : onReady(); //< Do what it's supposed to do once the condition is fulfilled
19
- clearInterval(interval); //< Stop this interval
20
- }
21
- }
22
- }, 100); //< repeat check every 100ms
23
- };
24
-
25
-
26
- if (system.args.length !== 2) {
27
- console.log('Usage: run-jasmine.js URL');
28
- phantom.exit();
29
- }
30
-
31
- function jasmineReportsFinished(page){
32
- return page.evaluate(function(){
33
- return jsApiReporter.finished;
34
- });
35
- }
36
-
37
1
  function collectJasmineResults() {
38
2
  console.log('');
39
3
  var suites = jsApiReporter.suites();
@@ -59,7 +23,7 @@ function collectJasmineResults() {
59
23
 
60
24
  function findSpecName(specId, suites) {
61
25
  for (var i in suites) {
62
- if (suites[i].id == specId) {
26
+ if (suites[i].id == specId && suites[i].type === "spec") {
63
27
  return suites[i].name;
64
28
  }
65
29
 
@@ -105,26 +69,44 @@ function sumUpAndExit(summary) {
105
69
  }
106
70
  }
107
71
 
108
- var page = require('webpage').create();
109
-
110
- // Route "console.log()" calls from within the Page context to the main Phantom context (i.e. current "this")
72
+ var page = require('webpage').create()
111
73
  page.onConsoleMessage = function(msg) {
112
74
  console.log(msg);
113
75
  };
114
76
 
115
- page.open(system.args[1], function(status){
116
- if (status !== "success") {
117
- console.log("Unable to access network");
118
- phantom.exit();
77
+ var system = require('system');
78
+
79
+ function jasmineReportsFinished(page){
80
+ return page.evaluate(function(){
81
+ return jsApiReporter.finished;
82
+ });
83
+ }
84
+
85
+ function waitForSpecsToFinish(page, seconds, whenDone) {
86
+ if (jasmineReportsFinished(page)) {
87
+ whenDone();
88
+ } else {
89
+ if (seconds > 0) {
90
+ setTimeout(
91
+ function() {waitForSpecsToFinish(page, seconds - 1, whenDone)},
92
+ 1000
93
+ );
94
+ } else {
95
+ console.log("Jasmine tests didn't finish in 30 seconds... bailing out");
96
+ phantom.exit(2);
97
+ }
98
+ }
99
+ }
100
+
101
+ page.open(system.args[1], function(status) {
102
+ if (status == 'success') {
103
+ waitForSpecsToFinish(page, 30, function() {
104
+ var summary = page.evaluate(collectJasmineResults);
105
+ sumUpAndExit(summary);
106
+ });
119
107
  } else {
120
- waitFor(
121
- "Jasmine specs to report finished",
122
- function() { return jasmineReportsFinished(page); },
123
- function(){
124
- var summary = page.evaluate(collectJasmineResults);
125
- sumUpAndExit(summary);
126
- },
127
- 30000
128
- );
108
+ console.log('Unable to connect to Jasmine server at ' + system.args[1]);
109
+ phantom.exit(3);
129
110
  }
130
111
  });
112
+
@@ -1,5 +1,5 @@
1
1
  module Jasmine
2
2
  module Phantom
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-phantom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-23 00:00:00.000000000 Z
12
+ date: 2012-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &2153244960 !ruby/object:Gem::Requirement
16
+ requirement: &2157907760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,18 +21,18 @@ dependencies:
21
21
  version: '3.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153244960
24
+ version_requirements: *2157907760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jasmine
27
- requirement: &2153244460 !ruby/object:Gem::Requirement
27
+ requirement: &2157906960 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 1.2.0rc2
32
+ version: 1.2.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153244460
35
+ version_requirements: *2157906960
36
36
  description: ! "jasmine-phantom provides a rake task, jasmine:phantom:ci,\n that
37
37
  runs your jasmine specs via the phantomjs browser just as if you had\n run
38
38
  rake jasmine and run them manually via your browser.\n\n You
@@ -45,6 +45,7 @@ extra_rdoc_files: []
45
45
  files:
46
46
  - .gitignore
47
47
  - Gemfile
48
+ - LICENSE
48
49
  - README.markdown
49
50
  - Rakefile
50
51
  - jasmine-phantom.gemspec
@@ -54,7 +55,8 @@ files:
54
55
  - lib/jasmine-phantom/tasks.rake
55
56
  - lib/jasmine-phantom/version.rb
56
57
  homepage: http://github.com/flipstone/jasmine-phantom
57
- licenses: []
58
+ licenses:
59
+ - MIT
58
60
  post_install_message:
59
61
  rdoc_options: []
60
62
  require_paths:
@@ -67,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
69
  version: '0'
68
70
  segments:
69
71
  - 0
70
- hash: 2734063739697641060
72
+ hash: 1067914802477270472
71
73
  required_rubygems_version: !ruby/object:Gem::Requirement
72
74
  none: false
73
75
  requirements:
@@ -76,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
78
  version: '0'
77
79
  segments:
78
80
  - 0
79
- hash: 2734063739697641060
81
+ hash: 1067914802477270472
80
82
  requirements: []
81
83
  rubyforge_project: jasmine-phantom
82
84
  rubygems_version: 1.8.6