konacha 3.7.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97bd31bc543a9f6f2c85d3109b3516554762fc10
4
- data.tar.gz: 9c77a26680c19837ffd8e28218cd76be31e288cf
3
+ metadata.gz: 0201ff45cc58c2033be683106451e6b683aab5b0
4
+ data.tar.gz: a9d739a850f57b301964ffe100e730c1e8a4e0c0
5
5
  SHA512:
6
- metadata.gz: a5034521ce296215be8e5ce6b362389c50e2a3d439155df07d0378bddd7017dc99c416aa9b15d761bcb4e492387ae1ee99fbd43f54717d020b113f03bd01152b
7
- data.tar.gz: 1cea843ff0fc9563aaf7c66fe1fdb5888e4146dcb56c8c7d7cacb7a6792687a72c229e119c69a543a4924cd9a517c4f64b3cea6c21561d0a3e44b55433511c48
6
+ metadata.gz: a73bd0818ad863363c1dc96178c3b44ccc9154cd59ac08987b20f4ff18f91788d9312760ff25a63dfc2294cf8952ba5d743fa5b78cee2bafb6c24a6ba82065b3
7
+ data.tar.gz: 8cf10947f8361cf9f0fe9bddb1db199669ceae5845078c56ec90e29f0bf93673f30f6067585b4e7ecd378fc56a9bb0778e8b0e0603eebafd31eae5ec086adf05
@@ -4,8 +4,8 @@ rvm:
4
4
  - 2.2.0
5
5
  gemfile:
6
6
  - Gemfile
7
- - Gemfile-rails3
8
- - Gemfile-rails40
7
+ - Gemfile-sprockets2-sprocketsrails2
8
+ - Gemfile-sprockets3-sprocketsrails2
9
9
  - Gemfile-rails41
10
10
  before_script:
11
11
  - sh -e /etc/init.d/xvfb start
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem "railties", "~> 4.2.0"
5
+ gem "sprockets", "~> 2.0"
6
+ gem "sprockets-rails", "~> 2.0"
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem "railties", "~> 4.2.0"
5
+ gem "sprockets", "~> 3.0"
6
+ gem "sprockets-rails", "~> 2.0"
data/History.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # master
2
2
 
3
+ # 4.0.0
4
+
5
+ * Add support for sprockets-rails 3.0 (#216)
6
+ * Rails < 4.1 is no longer supported
7
+
3
8
  # 3.7.0
4
9
 
5
10
  * Update chai (3.3.0) and mocha (2.3.2)
data/README.md CHANGED
@@ -239,10 +239,12 @@ Sprocket's built in support for JavaScript template (`.jst`) files. Add a `spec/
239
239
  directory, place template files there (using any JS template language supported by Sprockets),
240
240
  require them in your spec or spec_helper, and render them into the `<body>`.
241
241
 
242
- Note that if you want to use EJS as in the following example, you need to add that gem to your Gemfile:
242
+ The following example uses EJS. You can use an alternative templating language, like ECO, but you need to add something to your Gemfile in order for Sprokets to define the JST function and make your templates available.
243
243
 
244
244
  ```ruby
245
- gem "ejs"
245
+ group :development, :test do
246
+ gem "ejs"
247
+ end
246
248
  ```
247
249
 
248
250
  For example, in `spec/javascripts/templates/hello.jst.ejs`:
@@ -270,10 +272,10 @@ describe("templating", function() {
270
272
  });
271
273
  ```
272
274
 
273
- ## Upgrading from Konacha 2.x
275
+ ## Upgrading from Konacha 3.x
274
276
 
275
- The only backward-incompatible change in Konacha 3.0 is that Ruby 1.8.7 is
276
- no longer supported. Please upgrade to 1.9.3 or 2.0.
277
+ The only backward-incompatible change in Konacha 4.0 is that Rails versions
278
+ less than 4.1 are longer supported. Please upgrade to 4.1 or later.
277
279
 
278
280
  ## Contributing
279
281
 
@@ -17,12 +17,13 @@ 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 = "3.7.0"
20
+ gem.version = "4.0.0"
21
21
  gem.license = "MIT"
22
22
 
23
- gem.add_dependency "railties", ">= 3.1", "< 5"
24
- gem.add_dependency "actionpack", ">= 3.1", "< 5"
23
+ gem.add_dependency "railties", ">= 4.1", "< 5"
24
+ gem.add_dependency "actionpack", ">= 4.1", "< 5"
25
25
  gem.add_dependency "sprockets", ">= 2", "< 4"
26
+ gem.add_dependency "sprockets-rails", ">= 2", "< 4"
26
27
  gem.add_dependency "capybara"
27
28
  gem.add_dependency "colorize"
28
29
  gem.add_dependency "tilt"
@@ -60,5 +60,24 @@ module Konacha
60
60
  }.sort
61
61
  end
62
62
  end
63
+
64
+ def precompiled_assets
65
+ %W(konacha.css
66
+ chai.js
67
+ mocha.js
68
+ konacha/parent.js
69
+ konacha/iframe.js
70
+ konacha/runner.js).concat(spec_paths).map do |path|
71
+ path.gsub(/\.js\.coffee$/, ".js").gsub(/\.coffee$/, ".js")
72
+ end
73
+ end
74
+
75
+ def asset_precompiled?(logical_path)
76
+ precompiled_assets.include? logical_path
77
+ end
78
+
79
+ def sprockets_rails_3?
80
+ defined?(Sprockets::Rails::VERSION) && Sprockets::Rails::VERSION.start_with?('3')
81
+ end
63
82
  end
64
83
  end
@@ -11,7 +11,11 @@ module Konacha
11
11
  use Rack::ShowExceptions
12
12
 
13
13
  map app.config.assets.prefix do
14
- run app.assets
14
+ if Konacha.sprockets_rails_3?
15
+ run Sprockets::Railtie.build_environment(app)
16
+ else
17
+ run app.assets
18
+ end
15
19
  end
16
20
 
17
21
  map "/" do
@@ -37,7 +41,6 @@ module Konacha
37
41
  options.spec_matcher ||= /_spec\.|_test\./
38
42
  options.port ||= 3500
39
43
  options.host ||= 'localhost'
40
- options.application ||= self.class.application(app)
41
44
  options.driver ||= :selenium
42
45
  options.stylesheets ||= %w(application)
43
46
  options.javascripts ||= %w(chai konacha/iframe)
@@ -47,7 +50,21 @@ module Konacha
47
50
 
48
51
  spec_dirs = [options.spec_dir].flatten
49
52
  app.config.assets.paths += spec_dirs.map{|d| app.root.join(d).to_s}
50
- app.config.assets.raise_runtime_errors = false
53
+
54
+ if Konacha.sprockets_rails_3?
55
+ config.after_initialize do
56
+ ActiveSupport.on_load(:action_view) do
57
+ default_checker = ActionView::Base.precompiled_asset_checker
58
+ ActionView::Base.precompiled_asset_checker = -> logical_path do
59
+ default_checker[logical_path] || Konacha.asset_precompiled?(logical_path)
60
+ end
61
+ end
62
+ end
63
+ else
64
+ app.config.assets.raise_runtime_errors = false
65
+ end
66
+
67
+ options.application ||= self.class.application(app)
51
68
  end
52
69
  end
53
70
  end
@@ -1029,7 +1029,7 @@ function Mocha(options) {
1029
1029
  this.ui(options.ui);
1030
1030
  this.bail(options.bail);
1031
1031
  this.reporter(options.reporter, options.reporterOptions);
1032
- if (options.timeout != null) {
1032
+ if (typeof options.timeout !== 'undefined' && options.timeout !== null) {
1033
1033
  this.timeout(options.timeout);
1034
1034
  }
1035
1035
  this.useColors(options.useColors);
@@ -1751,7 +1751,14 @@ exports.list = function(failures) {
1751
1751
  // msg
1752
1752
  var msg;
1753
1753
  var err = test.err;
1754
- var message = err.message || '';
1754
+ var message;
1755
+ if (err.message) {
1756
+ message = err.message;
1757
+ } else if (typeof err.inspect === 'function') {
1758
+ message = err.inspect() + '';
1759
+ } else {
1760
+ message = '';
1761
+ }
1755
1762
  var stack = err.stack || message;
1756
1763
  var index = stack.indexOf(message);
1757
1764
  var actual = err.actual;
@@ -1983,7 +1990,7 @@ function unifiedDiff(err, escape) {
1983
1990
  return indent + line;
1984
1991
  }
1985
1992
  function notBlank(line) {
1986
- return line != null;
1993
+ return typeof line !== 'undefined' && line !== null;
1987
1994
  }
1988
1995
  var msg = diff.createPatch('string', err.actual, err.expected);
1989
1996
  var lines = msg.split('\n').splice(4);
@@ -3120,7 +3127,7 @@ function Markdown(runner) {
3120
3127
  var key = SUITE_PREFIX + suite.title;
3121
3128
 
3122
3129
  obj = obj[key] = obj[key] || { suite: suite };
3123
- suite.suites.forEach(function() {
3130
+ suite.suites.forEach(function(suite) {
3124
3131
  mapTOC(suite, obj);
3125
3132
  });
3126
3133
 
@@ -3813,6 +3820,11 @@ function XUnit(runner, options) {
3813
3820
  });
3814
3821
  }
3815
3822
 
3823
+ /**
3824
+ * Inherit from `Base.prototype`.
3825
+ */
3826
+ inherits(XUnit, Base);
3827
+
3816
3828
  /**
3817
3829
  * Override done to close the stream (if it's a file).
3818
3830
  *
@@ -3829,11 +3841,6 @@ XUnit.prototype.done = function(failures, fn) {
3829
3841
  }
3830
3842
  };
3831
3843
 
3832
- /**
3833
- * Inherit from `Base.prototype`.
3834
- */
3835
- inherits(XUnit, Base);
3836
-
3837
3844
  /**
3838
3845
  * Write out the given line.
3839
3846
  *
@@ -4240,6 +4247,7 @@ var Pending = require('./pending');
4240
4247
  var utils = require('./utils');
4241
4248
  var inherits = utils.inherits;
4242
4249
  var debug = require('debug')('mocha:runner');
4250
+ var Runnable = require('./runnable');
4243
4251
  var filter = utils.filter;
4244
4252
  var indexOf = utils.indexOf;
4245
4253
  var keys = utils.keys;
@@ -4297,6 +4305,7 @@ function Runner(suite, delay) {
4297
4305
  this._abort = false;
4298
4306
  this._delay = delay;
4299
4307
  this.suite = suite;
4308
+ this.started = false;
4300
4309
  this.total = suite.total();
4301
4310
  this.failures = 0;
4302
4311
  this.on('test end', function(test) {
@@ -4519,12 +4528,13 @@ Runner.prototype.hook = function(name, fn) {
4519
4528
 
4520
4529
  self.emit('hook', hook);
4521
4530
 
4522
- hook.on('error', function(err) {
4523
- self.failHook(hook, err);
4524
- });
4531
+ if (!hook.listeners('error').length) {
4532
+ hook.on('error', function(err) {
4533
+ self.failHook(hook, err);
4534
+ });
4535
+ }
4525
4536
 
4526
4537
  hook.run(function(err) {
4527
- hook.removeAllListeners('error');
4528
4538
  var testError = hook.error();
4529
4539
  if (testError) {
4530
4540
  self.fail(self.test, testError);
@@ -4619,7 +4629,8 @@ Runner.prototype.hookDown = function(name, fn) {
4619
4629
  Runner.prototype.parents = function() {
4620
4630
  var suite = this.suite;
4621
4631
  var suites = [];
4622
- while (suite = suite.parent) {
4632
+ while (suite.parent) {
4633
+ suite = suite.parent;
4623
4634
  suites.push(suite);
4624
4635
  }
4625
4636
  return suites;
@@ -4885,7 +4896,20 @@ Runner.prototype.uncaught = function(err) {
4885
4896
  err.uncaught = true;
4886
4897
 
4887
4898
  var runnable = this.currentRunnable;
4899
+
4888
4900
  if (!runnable) {
4901
+ runnable = new Runnable('Uncaught error outside test suite');
4902
+ runnable.parent = this.suite;
4903
+
4904
+ if (this.started) {
4905
+ this.fail(runnable, err);
4906
+ } else {
4907
+ // Can't recover from this failure
4908
+ this.emit('start');
4909
+ this.fail(runnable, err);
4910
+ this.emit('end');
4911
+ }
4912
+
4889
4913
  return;
4890
4914
  }
4891
4915
 
@@ -4944,6 +4968,7 @@ Runner.prototype.run = function(fn) {
4944
4968
  }
4945
4969
 
4946
4970
  function start() {
4971
+ self.started = true;
4947
4972
  self.emit('start');
4948
4973
  self.runSuite(rootSuite, function() {
4949
4974
  debug('finished running');
@@ -5039,7 +5064,8 @@ function filterLeaks(ok, globals) {
5039
5064
  */
5040
5065
  function extraGlobals() {
5041
5066
  if (typeof process === 'object' && typeof process.version === 'string') {
5042
- var nodeVersion = process.version.split('.').reduce(function(a, v) {
5067
+ var parts = process.version.split('.');
5068
+ var nodeVersion = utils.reduce(parts, function(a, v) {
5043
5069
  return a << 8 | v;
5044
5070
  });
5045
5071
 
@@ -5054,7 +5080,7 @@ function extraGlobals() {
5054
5080
  }
5055
5081
 
5056
5082
  }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
5057
- },{"./pending":16,"./utils":39,"_process":51,"debug":2,"events":3}],37:[function(require,module,exports){
5083
+ },{"./pending":16,"./runnable":35,"./utils":39,"_process":51,"debug":2,"events":3}],37:[function(require,module,exports){
5058
5084
  /**
5059
5085
  * Module dependencies.
5060
5086
  */
@@ -6146,7 +6172,7 @@ exports.getError = function(err) {
6146
6172
  * @description
6147
6173
  * When invoking this function you get a filter function that get the Error.stack as an input,
6148
6174
  * and return a prettify output.
6149
- * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace).
6175
+ * (i.e: strip Mocha and internal node functions from stack trace).
6150
6176
  * @returns {Function}
6151
6177
  */
6152
6178
  exports.stackTraceFilter = function() {
@@ -6158,14 +6184,10 @@ exports.stackTraceFilter = function() {
6158
6184
  : (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');
6159
6185
 
6160
6186
  function isMochaInternal(line) {
6161
- return (~line.indexOf('node_modules' + slash + 'mocha'))
6162
- || (~line.indexOf('components' + slash + 'mochajs'))
6163
- || (~line.indexOf('components' + slash + 'mocha'));
6164
- }
6165
-
6166
- // node_modules, bower, componentJS
6167
- function isBrowserModule(line) {
6168
- return (~line.indexOf('node_modules')) || (~line.indexOf('components'));
6187
+ return (~line.indexOf('node_modules' + slash + 'mocha' + slash))
6188
+ || (~line.indexOf('components' + slash + 'mochajs' + slash))
6189
+ || (~line.indexOf('components' + slash + 'mocha' + slash))
6190
+ || (~line.indexOf(slash + 'mocha.js'));
6169
6191
  }
6170
6192
 
6171
6193
  function isNodeInternal(line) {
@@ -6181,11 +6203,11 @@ exports.stackTraceFilter = function() {
6181
6203
  stack = stack.split('\n');
6182
6204
 
6183
6205
  stack = exports.reduce(stack, function(list, line) {
6184
- if (is.node && (isMochaInternal(line) || isNodeInternal(line))) {
6206
+ if (isMochaInternal(line)) {
6185
6207
  return list;
6186
6208
  }
6187
6209
 
6188
- if (is.browser && (isBrowserModule(line))) {
6210
+ if (is.node && isNodeInternal(line)) {
6189
6211
  return list;
6190
6212
  }
6191
6213
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konacha
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Firebaugh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2016-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '4.1'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '3.1'
29
+ version: '4.1'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5'
@@ -36,7 +36,7 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '3.1'
39
+ version: '4.1'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
42
  version: '5'
@@ -46,7 +46,7 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '3.1'
49
+ version: '4.1'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
52
  version: '5'
@@ -70,6 +70,26 @@ dependencies:
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
72
  version: '4'
73
+ - !ruby/object:Gem::Dependency
74
+ name: sprockets-rails
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '2'
80
+ - - "<"
81
+ - !ruby/object:Gem::Version
82
+ version: '4'
83
+ type: :runtime
84
+ prerelease: false
85
+ version_requirements: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '2'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '4'
73
93
  - !ruby/object:Gem::Dependency
74
94
  name: capybara
75
95
  requirement: !ruby/object:Gem::Requirement
@@ -242,9 +262,9 @@ files:
242
262
  - ".rspec"
243
263
  - ".travis.yml"
244
264
  - Gemfile
245
- - Gemfile-rails3
246
- - Gemfile-rails40
247
265
  - Gemfile-rails41
266
+ - Gemfile-sprockets2-sprocketsrails2
267
+ - Gemfile-sprockets3-sprocketsrails2
248
268
  - History.md
249
269
  - LICENSE
250
270
  - README.md
@@ -344,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
344
364
  version: '0'
345
365
  requirements: []
346
366
  rubyforge_project:
347
- rubygems_version: 2.4.5
367
+ rubygems_version: 2.4.5.1
348
368
  signing_key:
349
369
  specification_version: 4
350
370
  summary: Unit-test your Rails JavaScript with the mocha test framework and chai assertion
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem "railties", "~> 3.2"
5
- gem "actionpack", "~> 3.2"
6
- gem "test-unit", "~> 3.0"
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem "railties", "~> 4.0.0"
5
- gem "sprockets-rails"