qunited 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,10 +6,27 @@ Tests are run with PhantomJS if available, otherwise Rhino (Java) is used. Give
6
6
 
7
7
  ## Installation
8
8
 
9
+ Install with RubyGems.
10
+
9
11
  ```
10
12
  $ gem install qunited
11
13
  ```
12
14
 
15
+ If you are using Bundler you can add QUnited to your Gemfile. With Rails add QUnited to the test and development groups.
16
+
17
+ ```ruby
18
+ # In Gemfile
19
+ gem 'qunited'
20
+ ```
21
+
22
+ ```ruby
23
+ # With Rails
24
+ group :test, :development do
25
+ gem 'qunited'
26
+ end
27
+ ```
28
+
29
+
13
30
  ## Configuration
14
31
 
15
32
  Add the QUnited Rake task to your Rakefile. Specify your source and test JavaScript files.
@@ -64,6 +81,46 @@ Finished in 0.009 seconds, 1444.44 tests/s, 7777.78 assertions/s.
64
81
  13 tests, 70 assertions, 0 failures, 0 errors, 0 skips
65
82
  ```
66
83
 
84
+ You can change the name of the task...
85
+
86
+ ```ruby
87
+ QUnited::RakeTask.new('test:js') do |t|
88
+ # ...
89
+ end
90
+ ```
91
+ and run accordingly.
92
+
93
+ ```
94
+ $ rake test:js
95
+ ```
96
+
97
+ ### Running tests in your browser
98
+
99
+ If you've used QUnit before you've probably run tests in a browser. This is a lot of fun and makes for super quick development.
100
+
101
+ Run this rake task to start a server that serves up all of your specified source and test JavaScript in the standard QUnit test runner.
102
+
103
+ ```
104
+ $ rake qunited:server
105
+ ```
106
+
107
+ Then visit http://localhost:3040 in your browser and there they are.
108
+
109
+ <img src="http://i.imgur.com/o6Gx8.png" width="500px" />
110
+
111
+ If you specified your own task name then just append ':server' to the end. So if your task name is ```test:js``` then run the server with the following.
112
+ ```
113
+ $ rake test:js:server
114
+ ```
115
+
116
+ If the default port of 3040 doesn't suit you then choose one you like.
117
+ ```ruby
118
+ QUnited::RakeTask.new('test:js') do |t|
119
+ t.server_port = 8888
120
+ # ...
121
+ end
122
+ ```
123
+
67
124
  ## Drivers
68
125
 
69
126
  A JavaScript interpreter with browser APIs is necessary to run tests. Various drivers are provided to interface with programs to set up this environment.
@@ -62,6 +62,16 @@ QUnited.collectedTestResults = function() {
62
62
 
63
63
  /* Module results as a JSON string */
64
64
  QUnited.collectedTestResultsAsJson = function() {
65
+ // Prototype can mess up JSON.stringify and break results serialization. Get
66
+ // rid of the bad bits if they are present.
67
+ // http://stackoverflow.com/questions/710586/json-stringify-bizarreness
68
+ if (window.Prototype) {
69
+ delete Object.prototype.toJSON;
70
+ delete Array.prototype.toJSON;
71
+ delete Hash.prototype.toJSON;
72
+ delete String.prototype.toJSON;
73
+ }
74
+
65
75
  // The 3rd argument here adds spaces to the generated JSON string. This is necessary
66
76
  // for YAML parsers that are not compliant with YAML 1.2 (the version where YAML became
67
77
  // a true superset of JSON).
@@ -1,3 +1,3 @@
1
1
  module QUnited
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,33 +1,24 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: qunited
3
- version: !ruby/object:Gem::Version
4
- hash: 19
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Aaron Royer
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-17 00:00:00 Z
12
+ date: 2013-02-21 00:00:00.000000000 Z
19
13
  dependencies: []
20
-
21
14
  description: QUnited runs headless QUnit tests as part of your normal build
22
- email:
15
+ email:
23
16
  - aaronroyer@gmail.com
24
- executables:
17
+ executables:
25
18
  - qunited
26
19
  extensions: []
27
-
28
20
  extra_rdoc_files: []
29
-
30
- files:
21
+ files:
31
22
  - .gitignore
32
23
  - Gemfile
33
24
  - MIT-LICENSE
@@ -79,38 +70,29 @@ files:
79
70
  - test/unit/test_runner.rb
80
71
  homepage: https://github.com/aaronroyer/qunited
81
72
  licenses: []
82
-
83
73
  post_install_message:
84
74
  rdoc_options: []
85
-
86
- require_paths:
75
+ require_paths:
87
76
  - lib
88
- required_ruby_version: !ruby/object:Gem::Requirement
77
+ required_ruby_version: !ruby/object:Gem::Requirement
89
78
  none: false
90
- requirements:
91
- - - ">="
92
- - !ruby/object:Gem::Version
93
- hash: 3
94
- segments:
95
- - 0
96
- version: "0"
97
- required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
98
84
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
106
89
  requirements: []
107
-
108
90
  rubyforge_project: qunited
109
- rubygems_version: 1.8.15
91
+ rubygems_version: 1.8.23
110
92
  signing_key:
111
93
  specification_version: 3
112
94
  summary: QUnit tests in your build
113
- test_files:
95
+ test_files:
114
96
  - test/fixtures/basic_project/app/assets/javascripts/application.js
115
97
  - test/fixtures/basic_project/test/javascripts/test_basics.js
116
98
  - test/fixtures/basic_project/test/javascripts/test_math.js