konacha 2.0.0.beta1 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,3 @@
1
- window.mocha = parent.mocha;
2
- window.Mocha = parent.Mocha;
3
-
4
1
  window.Konacha = {
5
2
  reset: function() {
6
3
  document.body = document.createElement('body');
@@ -8,19 +5,26 @@ window.Konacha = {
8
5
  }
9
6
  };
10
7
 
11
- var suite = Mocha.Suite.create(mocha.suite);
8
+ window.Mocha = Object.create(parent.Mocha);
9
+ window.mocha = Object.create(parent.mocha);
10
+
11
+ // In order to isolate top-level before/beforeEach hooks,
12
+ // the specs in each iframe are wrapped in an anonymous suite.
13
+ mocha.suite = Mocha.Suite.create(mocha.suite);
12
14
 
15
+ // Override mocha.ui so that the pre-require event is emitted
16
+ // with the iframe's `window` reference, rather than the parent's.
13
17
  mocha.ui = function (name) {
14
18
  this._ui = Mocha.interfaces[name];
15
19
  if (!this._ui) throw new Error('invalid interface "' + name + '"');
16
- this._ui = this._ui(suite);
17
- suite.emit('pre-require', window, null, this);
20
+ this._ui = this._ui(this.suite);
21
+ this.suite.emit('pre-require', window, null, this);
18
22
  return this;
19
23
  };
20
24
 
21
25
  mocha.ui('bdd');
22
26
 
23
- suite.beforeAll(function () {
27
+ mocha.suite.beforeAll(function () {
24
28
  var contexts = parent.document.getElementsByClassName("test-context");
25
29
  for (var i = 0; i < contexts.length; ++i) {
26
30
  if (contexts[i].contentWindow == window) {
@@ -31,7 +35,7 @@ suite.beforeAll(function () {
31
35
  }
32
36
  });
33
37
 
34
- suite.beforeEach(function () {
38
+ mocha.suite.beforeEach(function () {
35
39
  Konacha.reset();
36
40
  });
37
41
 
@@ -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 = "2.0.0.beta1"
20
+ gem.version = "2.0.0.beta2"
21
21
 
22
22
  gem.add_dependency "railties", "~> 3.1"
23
23
  gem.add_dependency "actionpack", "~> 3.1"
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: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  prerelease: 6
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-09-29 00:00:00.000000000 Z
12
+ date: 2012-10-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -289,7 +289,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
289
289
  version: 1.3.1
290
290
  requirements: []
291
291
  rubyforge_project:
292
- rubygems_version: 1.8.24
292
+ rubygems_version: 1.8.23
293
293
  signing_key:
294
294
  specification_version: 3
295
295
  summary: Unit-test your Rails JavaScript with the mocha test framework and chai assertion