jasminerice 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- jasminerice (0.0.7)
4
+ jasminerice (0.0.9)
5
+ coffee-rails
5
6
  haml
6
7
 
7
8
  GEM
@@ -40,9 +41,18 @@ GEM
40
41
  bcrypt-ruby (3.0.1)
41
42
  bcrypt-ruby (3.0.1-java)
42
43
  builder (3.0.0)
44
+ coffee-rails (3.1.1)
45
+ coffee-script (>= 2.2.0)
46
+ railties (~> 3.1.0)
47
+ coffee-script (2.2.0)
48
+ coffee-script-source
49
+ execjs
50
+ coffee-script-source (1.3.3)
43
51
  columnize (0.3.4)
44
52
  erubis (2.7.0)
45
- haml (3.1.3)
53
+ execjs (1.4.0)
54
+ multi_json (~> 1.0)
55
+ haml (3.1.4)
46
56
  hike (1.2.1)
47
57
  i18n (0.6.0)
48
58
  json (1.6.1)
data/README.md CHANGED
@@ -18,7 +18,7 @@ This is a gem specifically for Rails 3.1. Just include it in
18
18
  your `Gemfile`:
19
19
 
20
20
  ```ruby
21
- group :development, :test
21
+ group :development, :test do
22
22
  gem "jasminerice"
23
23
  end
24
24
  ```
@@ -48,7 +48,7 @@ The Rails 3.1 asset pipeline using [Sprockets](https://github.com/sstephenson/sp
48
48
  and [Tilt](https://github.com/rtomayko/tilt) ensure conversion.
49
49
 
50
50
  As well you can use the `#require` dependency mechanisms in your specs to
51
- pull dependencies. Here's an example `spec/javascripts/foo.js.coffee`:
51
+ pull dependencies. Here's an example `spec/javascripts/foo_spec.js.coffee`:
52
52
 
53
53
  ```coffeescript
54
54
  #= require foo
@@ -63,7 +63,7 @@ describe "Bar", ->
63
63
  it "it is not foo", ->
64
64
  v = new Bar()
65
65
  expect(v.foo()).toEqual(false)
66
- ```
66
+ ```
67
67
 
68
68
  ### Stylesheets
69
69
 
@@ -95,6 +95,9 @@ available in your specs, you can load the `baz` fixture in your spec with:
95
95
  loadFixtures 'baz'
96
96
  ```
97
97
 
98
+ ### Helper Methods
99
+ You can declare Jasminerice::HelperMethods (perhaps put inside lib/) to make helpers available to jasminerice fixtures.
100
+
98
101
  ### Start server
99
102
 
100
103
  Now start your server
@@ -111,6 +114,29 @@ http://localhost:3000/jasmine
111
114
 
112
115
  and there are your specs.
113
116
 
117
+ ### Compatibility with Require.js
118
+
119
+ If you use [Require.js](http://requirejs.org/) in your project and need to load your
120
+ modules in your jasmine specs, there is an option to prevent jasminerice from automatically
121
+ executing the test runner before the modules are defined. This enables you to start the
122
+ execution manually whenever you want in your `spec/javascripts/spec.js.coffee` file:
123
+
124
+ #= require your/specs/and/other/stuff
125
+ # at the end of this file add:
126
+
127
+ jasmine.rice.autoExecute = false
128
+
129
+ define 'jasmine.waitsfor.requirejs', ->
130
+ require ['jasmine.waitsfor.requirejs'], ->
131
+ jasmine.getEnv().execute()
132
+
133
+ The shown example defines a dummy module in require.js that is required immediately on the next
134
+ line. This is a simple hack to wait until require.js has initialized all modules and start the
135
+ jasmine runner after that.
136
+
137
+ Of course you can use `jasmine.rice.autoExecute = false` also for all other cases where you need
138
+ to control when your specs should be executed!
139
+
114
140
  Author
115
141
  ------
116
142
 
@@ -17,8 +17,12 @@
17
17
  jasmineEnv.specFilter = (spec) ->
18
18
  trivialReporter.specFilter spec
19
19
 
20
+ jasmine.rice = {}
21
+ jasmine.rice.autoExecute = true
22
+
20
23
  currentWindowOnload = window.onload
21
24
  window.onload = ->
22
25
  currentWindowOnload() if currentWindowOnload
23
- execJasmine()
26
+ if jasmine.rice.autoExecute
27
+ execJasmine()
24
28
  )()
@@ -1,5 +1,10 @@
1
1
  module Jasminerice
2
2
  class SpecController < Jasminerice::ApplicationController
3
+ begin
4
+ include Jasminerice::HelperMethods
5
+ rescue
6
+ end
7
+
3
8
  layout false
4
9
 
5
10
  def index
@@ -3,7 +3,7 @@
3
3
  %title Jasmine Spec Runner
4
4
  = stylesheet_link_tag "jasmine"
5
5
  = stylesheet_link_tag "spec"
6
- = javascript_include_tag "jasminerice", :debug => Rails.env.development?
7
- = javascript_include_tag "spec", :debug => Rails.env.development?
6
+ = javascript_include_tag "jasminerice"
7
+ = javascript_include_tag "spec"
8
8
  = csrf_meta_tags
9
9
  %body
@@ -1 +1 @@
1
- Rails.application.config.assets.paths << File.join(Rails.root, "spec", "javascripts")
1
+ Rails.application.config.assets.paths << Rails.root.join("spec", "javascripts") << Rails.root.join("spec", "stylesheets")
@@ -1,14 +1,12 @@
1
1
  Jasminerice::Engine.routes.draw do
2
2
  resources :spec, :controller => 'spec', :only => [:index] do
3
- get "fixtures/:filename", :action => :fixtures
3
+ get "fixtures/*filename", :action => :fixtures
4
4
  end
5
- match "fixtures/:filename", :to => "spec#fixtures#:filename"
5
+ match "fixtures/*filename", :to => "spec#fixtures"
6
6
 
7
7
  root :to => "spec#index"
8
8
  end
9
9
 
10
10
  Rails.application.routes.draw do
11
- if Jasminerice.environments.include? Rails.env
12
- mount Jasminerice::Engine => "/jasmine"
13
- end
11
+ mount Jasminerice::Engine => "/jasmine"
14
12
  end
@@ -6,7 +6,8 @@ Gem::Specification.new do |s|
6
6
  s.description = "Full support for the Rails 3.1 asset pipeline when bdd'ing your coffeescript or javascript using jasmine"
7
7
  s.files = `git ls-files`.split "\n"
8
8
  s.authors = ["Brad Phelan"]
9
- s.version = "0.0.8"
9
+ s.version = "0.0.9"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.add_dependency( 'haml' )
12
+ s.add_dependency( 'coffee-rails' )
12
13
  end
@@ -2,6 +2,4 @@ require "jasminerice/engine"
2
2
  require 'haml'
3
3
 
4
4
  module Jasminerice
5
- mattr_accessor :environments
6
- self.environments = %w(development test)
7
5
  end
@@ -196,6 +196,21 @@ jasmine.any = function(clazz) {
196
196
  return new jasmine.Matchers.Any(clazz);
197
197
  };
198
198
 
199
+ /**
200
+ * Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
201
+ * attributes on the object.
202
+ *
203
+ * @example
204
+ * // don't care about any other attributes than foo.
205
+ * expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
206
+ *
207
+ * @param sample {Object} sample
208
+ * @returns matchable object for the sample
209
+ */
210
+ jasmine.objectContaining = function (sample) {
211
+ return new jasmine.Matchers.ObjectContaining(sample);
212
+ };
213
+
199
214
  /**
200
215
  * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
201
216
  *
@@ -735,12 +750,17 @@ jasmine.Env.prototype.version = function () {
735
750
  * @returns string containing jasmine version build info, if set.
736
751
  */
737
752
  jasmine.Env.prototype.versionString = function() {
738
- if (jasmine.version_) {
739
- var version = this.version();
740
- return version.major + "." + version.minor + "." + version.build + " revision " + version.revision;
741
- } else {
753
+ if (!jasmine.version_) {
742
754
  return "version unknown";
743
755
  }
756
+
757
+ var version = this.version();
758
+ var versionString = version.major + "." + version.minor + "." + version.build;
759
+ if (version.release_candidate) {
760
+ versionString += ".rc" + version.release_candidate;
761
+ }
762
+ versionString += " revision " + version.revision;
763
+ return versionString;
744
764
  };
745
765
 
746
766
  /**
@@ -909,11 +929,19 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
909
929
  return a.getTime() == b.getTime();
910
930
  }
911
931
 
912
- if (a instanceof jasmine.Matchers.Any) {
932
+ if (a.jasmineMatches) {
933
+ return a.jasmineMatches(b);
934
+ }
935
+
936
+ if (b.jasmineMatches) {
937
+ return b.jasmineMatches(a);
938
+ }
939
+
940
+ if (a instanceof jasmine.Matchers.ObjectContaining) {
913
941
  return a.matches(b);
914
942
  }
915
943
 
916
- if (b instanceof jasmine.Matchers.Any) {
944
+ if (b instanceof jasmine.Matchers.ObjectContaining) {
917
945
  return b.matches(a);
918
946
  }
919
947
 
@@ -1207,7 +1235,7 @@ jasmine.Matchers.prototype.toEqual = function(expected) {
1207
1235
  /**
1208
1236
  * toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
1209
1237
  * @param expected
1210
- * @deprecated as of 1.0. Use not.toNotEqual() instead.
1238
+ * @deprecated as of 1.0. Use not.toEqual() instead.
1211
1239
  */
1212
1240
  jasmine.Matchers.prototype.toNotEqual = function(expected) {
1213
1241
  return !this.env.equals_(this.actual, expected);
@@ -1380,7 +1408,7 @@ jasmine.Matchers.prototype.toContain = function(expected) {
1380
1408
  * Matcher that checks that the expected item is NOT an element in the actual Array.
1381
1409
  *
1382
1410
  * @param {Object} expected
1383
- * @deprecated as of 1.0. Use not.toNotContain() instead.
1411
+ * @deprecated as of 1.0. Use not.toContain() instead.
1384
1412
  */
1385
1413
  jasmine.Matchers.prototype.toNotContain = function(expected) {
1386
1414
  return !this.env.contains_(this.actual, expected);
@@ -1448,7 +1476,7 @@ jasmine.Matchers.Any = function(expectedClass) {
1448
1476
  this.expectedClass = expectedClass;
1449
1477
  };
1450
1478
 
1451
- jasmine.Matchers.Any.prototype.matches = function(other) {
1479
+ jasmine.Matchers.Any.prototype.jasmineMatches = function(other) {
1452
1480
  if (this.expectedClass == String) {
1453
1481
  return typeof other == 'string' || other instanceof String;
1454
1482
  }
@@ -1468,10 +1496,222 @@ jasmine.Matchers.Any.prototype.matches = function(other) {
1468
1496
  return other instanceof this.expectedClass;
1469
1497
  };
1470
1498
 
1471
- jasmine.Matchers.Any.prototype.toString = function() {
1499
+ jasmine.Matchers.Any.prototype.jasmineToString = function() {
1472
1500
  return '<jasmine.any(' + this.expectedClass + ')>';
1473
1501
  };
1474
1502
 
1503
+ jasmine.Matchers.ObjectContaining = function (sample) {
1504
+ this.sample = sample;
1505
+ };
1506
+
1507
+ jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
1508
+ mismatchKeys = mismatchKeys || [];
1509
+ mismatchValues = mismatchValues || [];
1510
+
1511
+ var env = jasmine.getEnv();
1512
+
1513
+ var hasKey = function(obj, keyName) {
1514
+ return obj != null && obj[keyName] !== jasmine.undefined;
1515
+ };
1516
+
1517
+ for (var property in this.sample) {
1518
+ if (!hasKey(other, property) && hasKey(this.sample, property)) {
1519
+ mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
1520
+ }
1521
+ else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) {
1522
+ mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual.");
1523
+ }
1524
+ }
1525
+
1526
+ return (mismatchKeys.length === 0 && mismatchValues.length === 0);
1527
+ };
1528
+
1529
+ jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () {
1530
+ return "<jasmine.objectContaining(" + jasmine.pp(this.sample) + ")>";
1531
+ };
1532
+ // Mock setTimeout, clearTimeout
1533
+ // Contributed by Pivotal Computer Systems, www.pivotalsf.com
1534
+
1535
+ jasmine.FakeTimer = function() {
1536
+ this.reset();
1537
+
1538
+ var self = this;
1539
+ self.setTimeout = function(funcToCall, millis) {
1540
+ self.timeoutsMade++;
1541
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
1542
+ return self.timeoutsMade;
1543
+ };
1544
+
1545
+ self.setInterval = function(funcToCall, millis) {
1546
+ self.timeoutsMade++;
1547
+ self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
1548
+ return self.timeoutsMade;
1549
+ };
1550
+
1551
+ self.clearTimeout = function(timeoutKey) {
1552
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
1553
+ };
1554
+
1555
+ self.clearInterval = function(timeoutKey) {
1556
+ self.scheduledFunctions[timeoutKey] = jasmine.undefined;
1557
+ };
1558
+
1559
+ };
1560
+
1561
+ jasmine.FakeTimer.prototype.reset = function() {
1562
+ this.timeoutsMade = 0;
1563
+ this.scheduledFunctions = {};
1564
+ this.nowMillis = 0;
1565
+ };
1566
+
1567
+ jasmine.FakeTimer.prototype.tick = function(millis) {
1568
+ var oldMillis = this.nowMillis;
1569
+ var newMillis = oldMillis + millis;
1570
+ this.runFunctionsWithinRange(oldMillis, newMillis);
1571
+ this.nowMillis = newMillis;
1572
+ };
1573
+
1574
+ jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
1575
+ var scheduledFunc;
1576
+ var funcsToRun = [];
1577
+ for (var timeoutKey in this.scheduledFunctions) {
1578
+ scheduledFunc = this.scheduledFunctions[timeoutKey];
1579
+ if (scheduledFunc != jasmine.undefined &&
1580
+ scheduledFunc.runAtMillis >= oldMillis &&
1581
+ scheduledFunc.runAtMillis <= nowMillis) {
1582
+ funcsToRun.push(scheduledFunc);
1583
+ this.scheduledFunctions[timeoutKey] = jasmine.undefined;
1584
+ }
1585
+ }
1586
+
1587
+ if (funcsToRun.length > 0) {
1588
+ funcsToRun.sort(function(a, b) {
1589
+ return a.runAtMillis - b.runAtMillis;
1590
+ });
1591
+ for (var i = 0; i < funcsToRun.length; ++i) {
1592
+ try {
1593
+ var funcToRun = funcsToRun[i];
1594
+ this.nowMillis = funcToRun.runAtMillis;
1595
+ funcToRun.funcToCall();
1596
+ if (funcToRun.recurring) {
1597
+ this.scheduleFunction(funcToRun.timeoutKey,
1598
+ funcToRun.funcToCall,
1599
+ funcToRun.millis,
1600
+ true);
1601
+ }
1602
+ } catch(e) {
1603
+ }
1604
+ }
1605
+ this.runFunctionsWithinRange(oldMillis, nowMillis);
1606
+ }
1607
+ };
1608
+
1609
+ jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
1610
+ this.scheduledFunctions[timeoutKey] = {
1611
+ runAtMillis: this.nowMillis + millis,
1612
+ funcToCall: funcToCall,
1613
+ recurring: recurring,
1614
+ timeoutKey: timeoutKey,
1615
+ millis: millis
1616
+ };
1617
+ };
1618
+
1619
+ /**
1620
+ * @namespace
1621
+ */
1622
+ jasmine.Clock = {
1623
+ defaultFakeTimer: new jasmine.FakeTimer(),
1624
+
1625
+ reset: function() {
1626
+ jasmine.Clock.assertInstalled();
1627
+ jasmine.Clock.defaultFakeTimer.reset();
1628
+ },
1629
+
1630
+ tick: function(millis) {
1631
+ jasmine.Clock.assertInstalled();
1632
+ jasmine.Clock.defaultFakeTimer.tick(millis);
1633
+ },
1634
+
1635
+ runFunctionsWithinRange: function(oldMillis, nowMillis) {
1636
+ jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
1637
+ },
1638
+
1639
+ scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
1640
+ jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
1641
+ },
1642
+
1643
+ useMock: function() {
1644
+ if (!jasmine.Clock.isInstalled()) {
1645
+ var spec = jasmine.getEnv().currentSpec;
1646
+ spec.after(jasmine.Clock.uninstallMock);
1647
+
1648
+ jasmine.Clock.installMock();
1649
+ }
1650
+ },
1651
+
1652
+ installMock: function() {
1653
+ jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
1654
+ },
1655
+
1656
+ uninstallMock: function() {
1657
+ jasmine.Clock.assertInstalled();
1658
+ jasmine.Clock.installed = jasmine.Clock.real;
1659
+ },
1660
+
1661
+ real: {
1662
+ setTimeout: jasmine.getGlobal().setTimeout,
1663
+ clearTimeout: jasmine.getGlobal().clearTimeout,
1664
+ setInterval: jasmine.getGlobal().setInterval,
1665
+ clearInterval: jasmine.getGlobal().clearInterval
1666
+ },
1667
+
1668
+ assertInstalled: function() {
1669
+ if (!jasmine.Clock.isInstalled()) {
1670
+ throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
1671
+ }
1672
+ },
1673
+
1674
+ isInstalled: function() {
1675
+ return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
1676
+ },
1677
+
1678
+ installed: null
1679
+ };
1680
+ jasmine.Clock.installed = jasmine.Clock.real;
1681
+
1682
+ //else for IE support
1683
+ jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
1684
+ if (jasmine.Clock.installed.setTimeout.apply) {
1685
+ return jasmine.Clock.installed.setTimeout.apply(this, arguments);
1686
+ } else {
1687
+ return jasmine.Clock.installed.setTimeout(funcToCall, millis);
1688
+ }
1689
+ };
1690
+
1691
+ jasmine.getGlobal().setInterval = function(funcToCall, millis) {
1692
+ if (jasmine.Clock.installed.setInterval.apply) {
1693
+ return jasmine.Clock.installed.setInterval.apply(this, arguments);
1694
+ } else {
1695
+ return jasmine.Clock.installed.setInterval(funcToCall, millis);
1696
+ }
1697
+ };
1698
+
1699
+ jasmine.getGlobal().clearTimeout = function(timeoutKey) {
1700
+ if (jasmine.Clock.installed.clearTimeout.apply) {
1701
+ return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
1702
+ } else {
1703
+ return jasmine.Clock.installed.clearTimeout(timeoutKey);
1704
+ }
1705
+ };
1706
+
1707
+ jasmine.getGlobal().clearInterval = function(timeoutKey) {
1708
+ if (jasmine.Clock.installed.clearTimeout.apply) {
1709
+ return jasmine.Clock.installed.clearInterval.apply(this, arguments);
1710
+ } else {
1711
+ return jasmine.Clock.installed.clearInterval(timeoutKey);
1712
+ }
1713
+ };
1714
+
1475
1715
  /**
1476
1716
  * @constructor
1477
1717
  */
@@ -1612,8 +1852,8 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
1612
1852
  this.emitScalar('null');
1613
1853
  } else if (value === jasmine.getGlobal()) {
1614
1854
  this.emitScalar('<global>');
1615
- } else if (value instanceof jasmine.Matchers.Any) {
1616
- this.emitScalar(value.toString());
1855
+ } else if (value.jasmineToString) {
1856
+ this.emitScalar(value.jasmineToString());
1617
1857
  } else if (typeof value === 'string') {
1618
1858
  this.emitString(value);
1619
1859
  } else if (jasmine.isSpy(value)) {
@@ -2280,192 +2520,10 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
2280
2520
  }, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
2281
2521
  }
2282
2522
  };
2283
- // Mock setTimeout, clearTimeout
2284
- // Contributed by Pivotal Computer Systems, www.pivotalsf.com
2285
-
2286
- jasmine.FakeTimer = function() {
2287
- this.reset();
2288
-
2289
- var self = this;
2290
- self.setTimeout = function(funcToCall, millis) {
2291
- self.timeoutsMade++;
2292
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
2293
- return self.timeoutsMade;
2294
- };
2295
-
2296
- self.setInterval = function(funcToCall, millis) {
2297
- self.timeoutsMade++;
2298
- self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
2299
- return self.timeoutsMade;
2300
- };
2301
-
2302
- self.clearTimeout = function(timeoutKey) {
2303
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2304
- };
2305
-
2306
- self.clearInterval = function(timeoutKey) {
2307
- self.scheduledFunctions[timeoutKey] = jasmine.undefined;
2308
- };
2309
-
2310
- };
2311
-
2312
- jasmine.FakeTimer.prototype.reset = function() {
2313
- this.timeoutsMade = 0;
2314
- this.scheduledFunctions = {};
2315
- this.nowMillis = 0;
2316
- };
2317
-
2318
- jasmine.FakeTimer.prototype.tick = function(millis) {
2319
- var oldMillis = this.nowMillis;
2320
- var newMillis = oldMillis + millis;
2321
- this.runFunctionsWithinRange(oldMillis, newMillis);
2322
- this.nowMillis = newMillis;
2323
- };
2324
-
2325
- jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
2326
- var scheduledFunc;
2327
- var funcsToRun = [];
2328
- for (var timeoutKey in this.scheduledFunctions) {
2329
- scheduledFunc = this.scheduledFunctions[timeoutKey];
2330
- if (scheduledFunc != jasmine.undefined &&
2331
- scheduledFunc.runAtMillis >= oldMillis &&
2332
- scheduledFunc.runAtMillis <= nowMillis) {
2333
- funcsToRun.push(scheduledFunc);
2334
- this.scheduledFunctions[timeoutKey] = jasmine.undefined;
2335
- }
2336
- }
2337
-
2338
- if (funcsToRun.length > 0) {
2339
- funcsToRun.sort(function(a, b) {
2340
- return a.runAtMillis - b.runAtMillis;
2341
- });
2342
- for (var i = 0; i < funcsToRun.length; ++i) {
2343
- try {
2344
- var funcToRun = funcsToRun[i];
2345
- this.nowMillis = funcToRun.runAtMillis;
2346
- funcToRun.funcToCall();
2347
- if (funcToRun.recurring) {
2348
- this.scheduleFunction(funcToRun.timeoutKey,
2349
- funcToRun.funcToCall,
2350
- funcToRun.millis,
2351
- true);
2352
- }
2353
- } catch(e) {
2354
- }
2355
- }
2356
- this.runFunctionsWithinRange(oldMillis, nowMillis);
2357
- }
2358
- };
2359
-
2360
- jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
2361
- this.scheduledFunctions[timeoutKey] = {
2362
- runAtMillis: this.nowMillis + millis,
2363
- funcToCall: funcToCall,
2364
- recurring: recurring,
2365
- timeoutKey: timeoutKey,
2366
- millis: millis
2367
- };
2368
- };
2369
-
2370
- /**
2371
- * @namespace
2372
- */
2373
- jasmine.Clock = {
2374
- defaultFakeTimer: new jasmine.FakeTimer(),
2375
-
2376
- reset: function() {
2377
- jasmine.Clock.assertInstalled();
2378
- jasmine.Clock.defaultFakeTimer.reset();
2379
- },
2380
-
2381
- tick: function(millis) {
2382
- jasmine.Clock.assertInstalled();
2383
- jasmine.Clock.defaultFakeTimer.tick(millis);
2384
- },
2385
-
2386
- runFunctionsWithinRange: function(oldMillis, nowMillis) {
2387
- jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
2388
- },
2389
-
2390
- scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
2391
- jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
2392
- },
2393
-
2394
- useMock: function() {
2395
- if (!jasmine.Clock.isInstalled()) {
2396
- var spec = jasmine.getEnv().currentSpec;
2397
- spec.after(jasmine.Clock.uninstallMock);
2398
-
2399
- jasmine.Clock.installMock();
2400
- }
2401
- },
2402
-
2403
- installMock: function() {
2404
- jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
2405
- },
2406
-
2407
- uninstallMock: function() {
2408
- jasmine.Clock.assertInstalled();
2409
- jasmine.Clock.installed = jasmine.Clock.real;
2410
- },
2411
-
2412
- real: {
2413
- setTimeout: jasmine.getGlobal().setTimeout,
2414
- clearTimeout: jasmine.getGlobal().clearTimeout,
2415
- setInterval: jasmine.getGlobal().setInterval,
2416
- clearInterval: jasmine.getGlobal().clearInterval
2417
- },
2418
-
2419
- assertInstalled: function() {
2420
- if (!jasmine.Clock.isInstalled()) {
2421
- throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
2422
- }
2423
- },
2424
-
2425
- isInstalled: function() {
2426
- return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
2427
- },
2428
-
2429
- installed: null
2430
- };
2431
- jasmine.Clock.installed = jasmine.Clock.real;
2432
-
2433
- //else for IE support
2434
- jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
2435
- if (jasmine.Clock.installed.setTimeout.apply) {
2436
- return jasmine.Clock.installed.setTimeout.apply(this, arguments);
2437
- } else {
2438
- return jasmine.Clock.installed.setTimeout(funcToCall, millis);
2439
- }
2440
- };
2441
-
2442
- jasmine.getGlobal().setInterval = function(funcToCall, millis) {
2443
- if (jasmine.Clock.installed.setInterval.apply) {
2444
- return jasmine.Clock.installed.setInterval.apply(this, arguments);
2445
- } else {
2446
- return jasmine.Clock.installed.setInterval(funcToCall, millis);
2447
- }
2448
- };
2449
-
2450
- jasmine.getGlobal().clearTimeout = function(timeoutKey) {
2451
- if (jasmine.Clock.installed.clearTimeout.apply) {
2452
- return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
2453
- } else {
2454
- return jasmine.Clock.installed.clearTimeout(timeoutKey);
2455
- }
2456
- };
2457
-
2458
- jasmine.getGlobal().clearInterval = function(timeoutKey) {
2459
- if (jasmine.Clock.installed.clearTimeout.apply) {
2460
- return jasmine.Clock.installed.clearInterval.apply(this, arguments);
2461
- } else {
2462
- return jasmine.Clock.installed.clearInterval(timeoutKey);
2463
- }
2464
- };
2465
2523
 
2466
2524
  jasmine.version_= {
2467
2525
  "major": 1,
2468
- "minor": 1,
2526
+ "minor": 2,
2469
2527
  "build": 0,
2470
- "revision": 1308150691
2471
- }
2528
+ "revision": 1337005947
2529
+ };
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jasminerice
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.8
5
+ version: 0.0.9
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brad Phelan
@@ -10,11 +10,10 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-11-04 00:00:00 Z
13
+ date: 2012-06-18 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: haml
17
- prerelease: false
18
17
  requirement: &id001 !ruby/object:Gem::Requirement
19
18
  none: false
20
19
  requirements:
@@ -22,7 +21,19 @@ dependencies:
22
21
  - !ruby/object:Gem::Version
23
22
  version: "0"
24
23
  type: :runtime
24
+ prerelease: false
25
25
  version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: coffee-rails
28
+ requirement: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *id002
26
37
  description: Full support for the Rails 3.1 asset pipeline when bdd'ing your coffeescript or javascript using jasmine
27
38
  email:
28
39
  executables: []
@@ -70,17 +81,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
81
  requirements:
71
82
  - - ">="
72
83
  - !ruby/object:Gem::Version
84
+ hash: -1621631643476018546
85
+ segments:
86
+ - 0
73
87
  version: "0"
74
88
  required_rubygems_version: !ruby/object:Gem::Requirement
75
89
  none: false
76
90
  requirements:
77
91
  - - ">="
78
92
  - !ruby/object:Gem::Version
93
+ hash: -1621631643476018546
94
+ segments:
95
+ - 0
79
96
  version: "0"
80
97
  requirements: []
81
98
 
82
99
  rubyforge_project:
83
- rubygems_version: 1.8.8
100
+ rubygems_version: 1.8.15
84
101
  signing_key:
85
102
  specification_version: 3
86
103
  summary: Pain free coffeescript unit testing for Rails 3.1 using jasmine