jasmine-core 2.5.1 → 2.5.2

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: 774cee200c94a97754d9739a092c927bed3c47b5
4
- data.tar.gz: 9fffe598451f68c2123a86d668196fc84a1f19ad
3
+ metadata.gz: 71429fa9b38c528a62e48585cd3be35b71141be6
4
+ data.tar.gz: d2ad921c951ae5a491c4df73ab4a845095958e51
5
5
  SHA512:
6
- metadata.gz: d518ed2a10b8238dd7d96fb65e5249007d7b8fc6fd94412e4597f0c8cd6aa27e73d06073c7da3e6d91cd17b80015dd9f9e7c6cbfa4bd4d24325c151e787144b4
7
- data.tar.gz: 5724768ad8f93bd18e26956316aad9b28fd797cb1d3142bf2f17ce7e94a95861cf2f82e5282ecd5437bfc3d224f7b0fe49b91e4ab76493417441c44d032dcf17
6
+ metadata.gz: f3b14ae8fb70a0389d96d21c6d341a1778e6716d641f0d4c522420892423487687644815506784c4f4ce85e5475066e0b68b5a3b4643291bfe64f5e3412d2074
7
+ data.tar.gz: 21a4d63fb89569f3175c4f0dc4be4f208d48acf35f3aca33f41337340dd42bd9d479c761abef3cc979869660994fc115cbf67254c5b88f8941aa4ea126b312ae
@@ -67,7 +67,7 @@ var getJasmineRequireObj = (function (jasmineGlobal) {
67
67
  j$.ReportDispatcher = jRequire.ReportDispatcher();
68
68
  j$.Spec = jRequire.Spec(j$);
69
69
  j$.SpyRegistry = jRequire.SpyRegistry(j$);
70
- j$.SpyStrategy = jRequire.SpyStrategy();
70
+ j$.SpyStrategy = jRequire.SpyStrategy(j$);
71
71
  j$.StringMatching = jRequire.StringMatching(j$);
72
72
  j$.Suite = jRequire.Suite(j$);
73
73
  j$.Timer = jRequire.Timer();
@@ -147,6 +147,10 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
147
147
  return j$.isA_('Number', value);
148
148
  };
149
149
 
150
+ j$.isFunction_ = function(value) {
151
+ return j$.isA_('Function', value);
152
+ };
153
+
150
154
  j$.isA_ = function(typeName, value) {
151
155
  return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
152
156
  };
@@ -788,6 +792,10 @@ getJasmineRequireObj().Env = function(j$) {
788
792
  reporter.provideFallbackReporter(reporterToAdd);
789
793
  };
790
794
 
795
+ this.clearReporters = function() {
796
+ reporter.clearReporters();
797
+ };
798
+
791
799
  var spyRegistry = new j$.SpyRegistry({currentSpies: function() {
792
800
  if(!currentRunnable()) {
793
801
  throw new Error('Spies must be created in a before function or a spec');
@@ -2013,11 +2021,14 @@ getJasmineRequireObj().ReportDispatcher = function() {
2013
2021
  this.addReporter = function(reporter) {
2014
2022
  reporters.push(reporter);
2015
2023
  };
2016
-
2024
+
2017
2025
  this.provideFallbackReporter = function(reporter) {
2018
2026
  fallbackReporter = reporter;
2019
2027
  };
2020
2028
 
2029
+ this.clearReporters = function() {
2030
+ reporters = [];
2031
+ };
2021
2032
 
2022
2033
  return this;
2023
2034
 
@@ -2120,7 +2131,7 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
2120
2131
  return SpyRegistry;
2121
2132
  };
2122
2133
 
2123
- getJasmineRequireObj().SpyStrategy = function() {
2134
+ getJasmineRequireObj().SpyStrategy = function(j$) {
2124
2135
 
2125
2136
  function SpyStrategy(options) {
2126
2137
  options = options || {};
@@ -2167,7 +2178,7 @@ getJasmineRequireObj().SpyStrategy = function() {
2167
2178
  };
2168
2179
 
2169
2180
  this.callFake = function(fn) {
2170
- if(!(fn instanceof Function)) {
2181
+ if(!j$.isFunction_(fn)) {
2171
2182
  throw new Error('Argument passed to callFake should be a function, got ' + fn);
2172
2183
  }
2173
2184
  plan = fn;
@@ -3640,5 +3651,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
3640
3651
  };
3641
3652
 
3642
3653
  getJasmineRequireObj().version = function() {
3643
- return '2.5.1';
3654
+ return '2.5.2';
3644
3655
  };
@@ -45,7 +45,6 @@ describe("ReportDispatcher", function() {
45
45
  dispatcher.provideFallbackReporter(reporter);
46
46
  dispatcher.foo(123, 456);
47
47
  expect(reporter.foo).toHaveBeenCalledWith(123, 456);
48
-
49
48
  });
50
49
 
51
50
  it("does not call fallback reporting methods when another report is provided", function() {
@@ -59,6 +58,22 @@ describe("ReportDispatcher", function() {
59
58
 
60
59
  expect(reporter.foo).toHaveBeenCalledWith(123, 456);
61
60
  expect(fallbackReporter.foo).not.toHaveBeenCalledWith(123, 456);
61
+ });
62
+
63
+ it("allows registered reporters to be cleared", function() {
64
+ var dispatcher = new jasmineUnderTest.ReportDispatcher(['foo', 'bar']),
65
+ reporter1 = jasmine.createSpyObj('reporter1', ['foo', 'bar']),
66
+ reporter2 = jasmine.createSpyObj('reporter2', ['foo', 'bar']);
67
+
68
+ dispatcher.addReporter(reporter1);
69
+ dispatcher.foo(123);
70
+ expect(reporter1.foo).toHaveBeenCalledWith(123);
71
+
72
+ dispatcher.clearReporters();
73
+ dispatcher.addReporter(reporter2);
74
+ dispatcher.bar(456);
62
75
 
76
+ expect(reporter1.bar).not.toHaveBeenCalled();
77
+ expect(reporter2.bar).toHaveBeenCalledWith(456);
63
78
  });
64
79
  });
@@ -94,14 +94,14 @@ describe("SpyStrategy", function() {
94
94
 
95
95
  it('throws an error when a non-function is passed to callFake strategy', function() {
96
96
  var originalFn = jasmine.createSpy('original'),
97
+ spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn}),
97
98
  invalidFakes = [5, 'foo', {}, true, false, null, void 0, new Date(), /.*/];
98
99
 
99
- for (var i=0; i<invalidFakes.length; i++) {
100
- var invalidFake = invalidFakes[i],
101
- spyStrategy = new jasmineUnderTest.SpyStrategy({fn: originalFn});
100
+ spyOn(jasmineUnderTest, 'isFunction_').and.returnValue(false);
102
101
 
103
- expect(function() {spyStrategy.callFake(invalidFake);}).toThrowError('Argument passed to callFake should be a function, got ' + invalidFake);
104
- }
102
+ expect(function () {
103
+ spyStrategy.callFake(function() {});
104
+ }).toThrowError(/^Argument passed to callFake should be a function, got/);
105
105
  });
106
106
 
107
107
  it("allows a return to plan stubbing after another strategy", function() {
@@ -4,6 +4,6 @@
4
4
  #
5
5
  module Jasmine
6
6
  module Core
7
- VERSION = "2.5.1"
7
+ VERSION = "2.5.2"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Agaskar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-09-07 00:00:00.000000000 Z
13
+ date: 2016-09-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake