konacha 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +6 -0
- data/README.md +9 -3
- data/Rakefile +2 -2
- data/konacha.gemspec +1 -2
- data/lib/assets/javascripts/konacha.js +1 -1
- data/lib/konacha.rb +9 -3
- data/spec/dummy/spec/javascripts/do_not_include_spec.js.bak +0 -0
- data/spec/dummy/spec/javascripts/do_not_include_spec.png +0 -0
- data/spec/konacha_spec.rb +8 -0
- data/vendor/assets/javascripts/mocha.js +19 -15
- metadata +8 -20
data/History.md
CHANGED
data/README.md
CHANGED
@@ -143,6 +143,10 @@ named `konacha_config.js` or `konacha_config.js.coffee` in `spec/javascripts` an
|
|
143
143
|
setting properties of `Konacha.mochaOptions`:
|
144
144
|
|
145
145
|
```javascript
|
146
|
+
// set the Mocha test interface
|
147
|
+
// see http://visionmedia.github.com/mocha/#interfaces
|
148
|
+
Konacha.mochaOptions.ui = 'bdd';
|
149
|
+
|
146
150
|
// ignore the following globals during leak detection
|
147
151
|
Konacha.mochaOptions.globals = ['YUI'];
|
148
152
|
|
@@ -158,14 +162,16 @@ The `ui` and `reporter` Mocha options are set by Konacha and must not be modifie
|
|
158
162
|
## Test Interface and Assertions
|
159
163
|
|
160
164
|
Konacha includes a vendored copy of mocha.js and the [chai](http://chaijs.com/)
|
161
|
-
assertion libraries.
|
162
|
-
provides `describe()`, `it()`, `before()`, `after()`,
|
165
|
+
assertion libraries. By default, it configures Mocha to use the "BDD" test
|
166
|
+
interface, which provides `describe()`, `it()`, `before()`, `after()`,
|
167
|
+
`beforeEach()`, and `afterEach()`.
|
163
168
|
|
164
169
|
Konacha will make all three of chai's assertion styles available to you: `expect`,
|
165
170
|
`should`, and `assert`. See the chai documentation for the details.
|
166
171
|
|
167
172
|
If you use jQuery, you may want to check out [chai-jquery](https://github.com/jfirebaugh/chai-jquery)
|
168
|
-
for some jQuery-specific assertions.
|
173
|
+
for some jQuery-specific assertions. You can add it painlessly with the
|
174
|
+
[chai-jquery-rails](https://github.com/wordofchristian/chai-jquery-rails) gem.
|
169
175
|
|
170
176
|
## Transactions
|
171
177
|
|
data/Rakefile
CHANGED
@@ -8,8 +8,8 @@ RSpec::Core::RakeTask.new :spec
|
|
8
8
|
desc 'Build and copy Mocha and Chai assets from submodules into vendor/assets'
|
9
9
|
task :assets do
|
10
10
|
sh 'git submodule update --init' unless File.exist?('mocha/Makefile') || File.exist?('chai/Makefile')
|
11
|
-
sh 'cd mocha && make clean && make'
|
12
|
-
sh 'cd chai && make clean && make'
|
11
|
+
sh 'cd mocha && npm install && make clean && make'
|
12
|
+
sh 'cd chai && npm install && make clean && make'
|
13
13
|
mkdir_p 'vendor/assets/javascripts'
|
14
14
|
mkdir_p 'vendor/assets/stylesheets'
|
15
15
|
cp 'mocha/mocha.js', 'vendor/assets/javascripts/'
|
data/konacha.gemspec
CHANGED
@@ -17,7 +17,7 @@ the asset pipeline and engines.}
|
|
17
17
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
gem.name = "konacha"
|
19
19
|
gem.require_paths = ["lib"]
|
20
|
-
gem.version = "1.
|
20
|
+
gem.version = "1.4.0"
|
21
21
|
|
22
22
|
gem.add_dependency "railties", "~> 3.1"
|
23
23
|
gem.add_dependency "actionpack", "~> 3.1"
|
@@ -29,6 +29,5 @@ the asset pipeline and engines.}
|
|
29
29
|
gem.add_development_dependency "capybara-firebug", "~> 1.1"
|
30
30
|
gem.add_development_dependency "coffee-script"
|
31
31
|
gem.add_development_dependency "ejs"
|
32
|
-
gem.add_development_dependency "vendorer"
|
33
32
|
gem.add_development_dependency "tzinfo"
|
34
33
|
end
|
data/lib/konacha.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require "tilt"
|
1
2
|
require "konacha/engine"
|
2
3
|
require "konacha/runner"
|
3
4
|
require "konacha/server"
|
@@ -33,9 +34,14 @@ module Konacha
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def spec_paths
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
Rails.application.assets.each_file.find_all { |pathname|
|
38
|
+
pathname.to_s.start_with?(spec_root) &&
|
39
|
+
pathname.basename.to_s =~ /_spec\.|_test\./ &&
|
40
|
+
(pathname.extname == '.js' || Tilt[pathname]) &&
|
41
|
+
Rails.application.assets.content_type_of(pathname) == 'application/javascript'
|
42
|
+
}.map { |pathname|
|
43
|
+
pathname.to_s.gsub(File.join(spec_root, ''), '')
|
44
|
+
}
|
39
45
|
end
|
40
46
|
end
|
41
47
|
end
|
File without changes
|
File without changes
|
data/spec/konacha_spec.rb
CHANGED
@@ -54,6 +54,14 @@ describe Konacha do
|
|
54
54
|
it "includes *_test.* files" do
|
55
55
|
subject.should include("file_ending_in_test.js")
|
56
56
|
end
|
57
|
+
|
58
|
+
it "only includes JavaScript files" do
|
59
|
+
subject.should_not include("do_not_include_spec.png")
|
60
|
+
end
|
61
|
+
|
62
|
+
it "does not include non-asset files" do
|
63
|
+
subject.should_not include("do_not_include_spec.js.bak")
|
64
|
+
end
|
57
65
|
end
|
58
66
|
|
59
67
|
it "can be configured in an initializer" do
|
@@ -885,12 +885,6 @@ var path = require('browser/path');
|
|
885
885
|
|
886
886
|
exports = module.exports = Mocha;
|
887
887
|
|
888
|
-
/**
|
889
|
-
* Library version.
|
890
|
-
*/
|
891
|
-
|
892
|
-
exports.version = '1.2.1';
|
893
|
-
|
894
888
|
/**
|
895
889
|
* Expose internals.
|
896
890
|
*/
|
@@ -1683,7 +1677,7 @@ function HTML(runner) {
|
|
1683
1677
|
|
1684
1678
|
// suite
|
1685
1679
|
var url = location.protocol + '//' + location.host + location.pathname + '?grep=^' + utils.escapeRegexp(suite.fullTitle());
|
1686
|
-
var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, suite.title);
|
1680
|
+
var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
|
1687
1681
|
|
1688
1682
|
// container
|
1689
1683
|
stack[0].appendChild(el);
|
@@ -1701,6 +1695,8 @@ function HTML(runner) {
|
|
1701
1695
|
});
|
1702
1696
|
|
1703
1697
|
runner.on('test end', function(test){
|
1698
|
+
window.scrollTo(0, document.body.scrollHeight);
|
1699
|
+
|
1704
1700
|
// TODO: add to stats
|
1705
1701
|
var percent = stats.tests / total * 100 | 0;
|
1706
1702
|
if (progress) progress.update(percent).draw(ctx);
|
@@ -1821,13 +1817,14 @@ exports.HTML = require('./html');
|
|
1821
1817
|
exports.List = require('./list');
|
1822
1818
|
exports.Min = require('./min');
|
1823
1819
|
exports.Spec = require('./spec');
|
1820
|
+
exports.Nyan = require('./nyan');
|
1821
|
+
exports.XUnit = require('./xunit');
|
1824
1822
|
exports.Progress = require('./progress');
|
1825
1823
|
exports.Landing = require('./landing');
|
1826
1824
|
exports.JSONCov = require('./json-cov');
|
1827
1825
|
exports.HTMLCov = require('./html-cov');
|
1828
1826
|
exports.JSONStream = require('./json-stream');
|
1829
|
-
exports.
|
1830
|
-
exports.Teamcity = require('./teamcity')
|
1827
|
+
exports.Teamcity = require('./teamcity');
|
1831
1828
|
|
1832
1829
|
}); // module: reporters/index.js
|
1833
1830
|
|
@@ -2389,6 +2386,7 @@ function Markdown(runner) {
|
|
2389
2386
|
}); // module: reporters/markdown.js
|
2390
2387
|
|
2391
2388
|
require.register("reporters/min.js", function(module, exports, require){
|
2389
|
+
|
2392
2390
|
/**
|
2393
2391
|
* Module dependencies.
|
2394
2392
|
*/
|
@@ -3284,16 +3282,16 @@ Runnable.prototype.run = function(fn){
|
|
3284
3282
|
}
|
3285
3283
|
|
3286
3284
|
// called multiple times
|
3287
|
-
function multiple() {
|
3285
|
+
function multiple(err) {
|
3288
3286
|
if (emitted) return;
|
3289
3287
|
emitted = true;
|
3290
|
-
self.emit('error', new Error('done() called multiple times'));
|
3288
|
+
self.emit('error', err || new Error('done() called multiple times'));
|
3291
3289
|
}
|
3292
3290
|
|
3293
3291
|
// finished
|
3294
3292
|
function done(err) {
|
3295
3293
|
if (self.timedOut) return;
|
3296
|
-
if (finished) return multiple();
|
3294
|
+
if (finished) return multiple(err);
|
3297
3295
|
self.clearTimeout();
|
3298
3296
|
self.duration = new Date - start;
|
3299
3297
|
finished = true;
|
@@ -3393,13 +3391,15 @@ Runner.prototype.constructor = Runner;
|
|
3393
3391
|
* with number of tests matched.
|
3394
3392
|
*
|
3395
3393
|
* @param {RegExp} re
|
3394
|
+
* @param {Boolean} invert
|
3396
3395
|
* @return {Runner} for chaining
|
3397
3396
|
* @api public
|
3398
3397
|
*/
|
3399
3398
|
|
3400
|
-
Runner.prototype.grep = function(re){
|
3399
|
+
Runner.prototype.grep = function(re, invert){
|
3401
3400
|
debug('grep %s', re);
|
3402
3401
|
this._grep = re;
|
3402
|
+
this._invert = invert;
|
3403
3403
|
this.total = this.grepTotal(this.suite);
|
3404
3404
|
return this;
|
3405
3405
|
};
|
@@ -3418,7 +3418,9 @@ Runner.prototype.grepTotal = function(suite) {
|
|
3418
3418
|
var total = 0;
|
3419
3419
|
|
3420
3420
|
suite.eachTest(function(test){
|
3421
|
-
|
3421
|
+
var match = self._grep.test(test.fullTitle());
|
3422
|
+
if (self._invert) match = !match;
|
3423
|
+
if (match) total++;
|
3422
3424
|
});
|
3423
3425
|
|
3424
3426
|
return total;
|
@@ -3658,7 +3660,9 @@ Runner.prototype.runTests = function(suite, fn){
|
|
3658
3660
|
if (!test) return fn();
|
3659
3661
|
|
3660
3662
|
// grep
|
3661
|
-
|
3663
|
+
var match = self._grep.test(test.fullTitle());
|
3664
|
+
if (self._invert) match = !match;
|
3665
|
+
if (!match) return next();
|
3662
3666
|
|
3663
3667
|
// pending
|
3664
3668
|
if (test.pending) {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: konacha
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.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: 2012-07-
|
12
|
+
date: 2012-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -155,22 +155,6 @@ dependencies:
|
|
155
155
|
- - ! '>='
|
156
156
|
- !ruby/object:Gem::Version
|
157
157
|
version: '0'
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: vendorer
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ! '>='
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
166
|
-
type: :development
|
167
|
-
prerelease: false
|
168
|
-
version_requirements: !ruby/object:Gem::Requirement
|
169
|
-
none: false
|
170
|
-
requirements:
|
171
|
-
- - ! '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
158
|
- !ruby/object:Gem::Dependency
|
175
159
|
name: tzinfo
|
176
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -241,6 +225,8 @@ files:
|
|
241
225
|
- spec/dummy/spec/javascripts/array_sum_cs_spec.js.coffee
|
242
226
|
- spec/dummy/spec/javascripts/array_sum_js_spec.js
|
243
227
|
- spec/dummy/spec/javascripts/assert_spec.js.coffee
|
228
|
+
- spec/dummy/spec/javascripts/do_not_include_spec.js.bak
|
229
|
+
- spec/dummy/spec/javascripts/do_not_include_spec.png
|
244
230
|
- spec/dummy/spec/javascripts/failing_spec.js
|
245
231
|
- spec/dummy/spec/javascripts/file_ending_in_test.js
|
246
232
|
- spec/dummy/spec/javascripts/konacha_config.js
|
@@ -275,7 +261,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
275
261
|
version: '0'
|
276
262
|
segments:
|
277
263
|
- 0
|
278
|
-
hash:
|
264
|
+
hash: 3335057078696497361
|
279
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
280
266
|
none: false
|
281
267
|
requirements:
|
@@ -284,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
284
270
|
version: '0'
|
285
271
|
segments:
|
286
272
|
- 0
|
287
|
-
hash:
|
273
|
+
hash: 3335057078696497361
|
288
274
|
requirements: []
|
289
275
|
rubyforge_project:
|
290
276
|
rubygems_version: 1.8.24
|
@@ -305,6 +291,8 @@ test_files:
|
|
305
291
|
- spec/dummy/spec/javascripts/array_sum_cs_spec.js.coffee
|
306
292
|
- spec/dummy/spec/javascripts/array_sum_js_spec.js
|
307
293
|
- spec/dummy/spec/javascripts/assert_spec.js.coffee
|
294
|
+
- spec/dummy/spec/javascripts/do_not_include_spec.js.bak
|
295
|
+
- spec/dummy/spec/javascripts/do_not_include_spec.png
|
308
296
|
- spec/dummy/spec/javascripts/failing_spec.js
|
309
297
|
- spec/dummy/spec/javascripts/file_ending_in_test.js
|
310
298
|
- spec/dummy/spec/javascripts/konacha_config.js
|