evergreen 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. data/README.rdoc +4 -0
  2. data/bin/evergreen +18 -0
  3. data/lib/evergreen.rb +44 -0
  4. data/lib/evergreen/cli.rb +23 -0
  5. data/lib/evergreen/evergreen.js +3 -0
  6. data/lib/evergreen/runner.rb +56 -0
  7. data/lib/evergreen/server.rb +31 -0
  8. data/lib/evergreen/spec.rb +60 -0
  9. data/lib/evergreen/version.rb +3 -0
  10. data/lib/evergreen/views/list.erb +6 -0
  11. data/lib/evergreen/views/spec.erb +37 -0
  12. data/lib/jasmine/MIT.LICENSE +20 -0
  13. data/lib/jasmine/README.markdown +489 -0
  14. data/lib/jasmine/Rakefile +146 -0
  15. data/lib/jasmine/cruise_config.rb +21 -0
  16. data/lib/jasmine/doc/files.html +460 -0
  17. data/lib/jasmine/doc/index.html +322 -0
  18. data/lib/jasmine/doc/symbols/_global_.html +918 -0
  19. data/lib/jasmine/doc/symbols/jasmine.Block.html +417 -0
  20. data/lib/jasmine/doc/symbols/jasmine.Clock.html +678 -0
  21. data/lib/jasmine/doc/symbols/jasmine.Env.html +1169 -0
  22. data/lib/jasmine/doc/symbols/jasmine.JsApiReporter.html +822 -0
  23. data/lib/jasmine/doc/symbols/jasmine.Matchers.html +1474 -0
  24. data/lib/jasmine/doc/symbols/jasmine.MultiReporter.html +394 -0
  25. data/lib/jasmine/doc/symbols/jasmine.NestedResults.html +710 -0
  26. data/lib/jasmine/doc/symbols/jasmine.Reporter.html +574 -0
  27. data/lib/jasmine/doc/symbols/jasmine.Runner.html +710 -0
  28. data/lib/jasmine/doc/symbols/jasmine.Spec.html +1253 -0
  29. data/lib/jasmine/doc/symbols/jasmine.Spy.html +855 -0
  30. data/lib/jasmine/doc/symbols/jasmine.Suite.html +705 -0
  31. data/lib/jasmine/doc/symbols/jasmine.html +1345 -0
  32. data/lib/jasmine/doc/symbols/jasmine.util.html +535 -0
  33. data/lib/jasmine/doc/symbols/src/lib_TrivialReporter.js.html +124 -0
  34. data/lib/jasmine/doc/symbols/src/src_Block.js.html +29 -0
  35. data/lib/jasmine/doc/symbols/src/src_Env.js.html +248 -0
  36. data/lib/jasmine/doc/symbols/src/src_JsApiReporter.js.html +111 -0
  37. data/lib/jasmine/doc/symbols/src/src_Matchers.js.html +344 -0
  38. data/lib/jasmine/doc/symbols/src/src_MultiReporter.js.html +36 -0
  39. data/lib/jasmine/doc/symbols/src/src_NestedResults.js.html +88 -0
  40. data/lib/jasmine/doc/symbols/src/src_PrettyPrinter.js.html +130 -0
  41. data/lib/jasmine/doc/symbols/src/src_Queue.js.html +102 -0
  42. data/lib/jasmine/doc/symbols/src/src_Reporter.js.html +35 -0
  43. data/lib/jasmine/doc/symbols/src/src_Reporters.js.html +51 -0
  44. data/lib/jasmine/doc/symbols/src/src_Runner.js.html +75 -0
  45. data/lib/jasmine/doc/symbols/src/src_Spec.js.html +214 -0
  46. data/lib/jasmine/doc/symbols/src/src_Suite.js.html +77 -0
  47. data/lib/jasmine/doc/symbols/src/src_WaitsBlock.js.html +21 -0
  48. data/lib/jasmine/doc/symbols/src/src_WaitsForBlock.js.html +45 -0
  49. data/lib/jasmine/doc/symbols/src/src_base.js.html +585 -0
  50. data/lib/jasmine/doc/symbols/src/src_mock-timeout.js.html +185 -0
  51. data/lib/jasmine/doc/symbols/src/src_util.js.html +75 -0
  52. data/lib/jasmine/example/example_runner.html +22 -0
  53. data/lib/jasmine/example/spec/example_suite.js +11 -0
  54. data/lib/jasmine/images/fail-16.png +0 -0
  55. data/lib/jasmine/images/fail.png +0 -0
  56. data/lib/jasmine/images/go-16.png +0 -0
  57. data/lib/jasmine/images/go.png +0 -0
  58. data/lib/jasmine/images/pending-16.png +0 -0
  59. data/lib/jasmine/images/pending.png +0 -0
  60. data/lib/jasmine/images/question-bk.png +0 -0
  61. data/lib/jasmine/images/questionbk-16.png +0 -0
  62. data/lib/jasmine/images/spinner.gif +0 -0
  63. data/lib/jasmine/lib/TrivialReporter.js +171 -0
  64. data/lib/jasmine/lib/consolex.js +28 -0
  65. data/lib/jasmine/lib/jasmine-0.10.4.js +2371 -0
  66. data/lib/jasmine/lib/jasmine.css +166 -0
  67. data/lib/jasmine/lib/json2.js +478 -0
  68. data/lib/jasmine/spec/jasmine_helper.rb +44 -0
  69. data/lib/jasmine/spec/jasmine_spec.rb +31 -0
  70. data/lib/jasmine/spec/runner.html +80 -0
  71. data/lib/jasmine/spec/saucelabs.yml +24 -0
  72. data/lib/jasmine/spec/suites/CustomMatchersSpec.js +112 -0
  73. data/lib/jasmine/spec/suites/EnvSpec.js +158 -0
  74. data/lib/jasmine/spec/suites/ExceptionsSpec.js +107 -0
  75. data/lib/jasmine/spec/suites/JsApiReporterSpec.js +96 -0
  76. data/lib/jasmine/spec/suites/MatchersSpec.js +709 -0
  77. data/lib/jasmine/spec/suites/MockClockSpec.js +34 -0
  78. data/lib/jasmine/spec/suites/MultiReporterSpec.js +30 -0
  79. data/lib/jasmine/spec/suites/NestedResultsSpec.js +54 -0
  80. data/lib/jasmine/spec/suites/PrettyPrintSpec.js +93 -0
  81. data/lib/jasmine/spec/suites/QueueSpec.js +23 -0
  82. data/lib/jasmine/spec/suites/ReporterSpec.js +60 -0
  83. data/lib/jasmine/spec/suites/RunnerSpec.js +267 -0
  84. data/lib/jasmine/spec/suites/SpecRunningSpec.js +1195 -0
  85. data/lib/jasmine/spec/suites/SpecSpec.js +110 -0
  86. data/lib/jasmine/spec/suites/SpySpec.js +201 -0
  87. data/lib/jasmine/spec/suites/SuiteSpec.js +120 -0
  88. data/lib/jasmine/spec/suites/TrivialReporterSpec.js +158 -0
  89. data/lib/jasmine/spec/suites/UtilSpec.js +40 -0
  90. data/lib/jasmine/spec/suites/WaitsForBlockSpec.js +88 -0
  91. data/lib/jasmine/src/Block.js +22 -0
  92. data/lib/jasmine/src/Env.js +263 -0
  93. data/lib/jasmine/src/JsApiReporter.js +104 -0
  94. data/lib/jasmine/src/Matchers.js +336 -0
  95. data/lib/jasmine/src/MultiReporter.js +28 -0
  96. data/lib/jasmine/src/NestedResults.js +80 -0
  97. data/lib/jasmine/src/PrettyPrinter.js +122 -0
  98. data/lib/jasmine/src/Queue.js +94 -0
  99. data/lib/jasmine/src/Reporter.js +27 -0
  100. data/lib/jasmine/src/Reporters.js +43 -0
  101. data/lib/jasmine/src/Runner.js +77 -0
  102. data/lib/jasmine/src/Spec.js +206 -0
  103. data/lib/jasmine/src/Suite.js +82 -0
  104. data/lib/jasmine/src/WaitsBlock.js +13 -0
  105. data/lib/jasmine/src/WaitsForBlock.js +37 -0
  106. data/lib/jasmine/src/base.js +586 -0
  107. data/lib/jasmine/src/mock-timeout.js +177 -0
  108. data/lib/jasmine/src/util.js +67 -0
  109. data/lib/jasmine/src/version.json +5 -0
  110. metadata +238 -0
@@ -0,0 +1,44 @@
1
+ class JasmineHelper
2
+ def self.jasmine_lib_dir
3
+ File.expand_path(File.join(jasmine_root, 'lib'))
4
+ end
5
+
6
+ def self.jasmine
7
+ ['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] +
8
+ ['/lib/json2.js',
9
+ '/lib/TrivialReporter.js']
10
+ end
11
+
12
+ def self.jasmine_root
13
+ File.expand_path(File.join(File.dirname(__FILE__), '..'))
14
+ end
15
+
16
+
17
+ def self.jasmine_src_dir
18
+ File.expand_path(File.join(jasmine_root, 'src'))
19
+ end
20
+
21
+ def self.jasmine_lib_dir
22
+ File.expand_path(File.join(jasmine_root, 'lib'))
23
+ end
24
+
25
+ def self.jasmine_spec_dir
26
+ File.expand_path(File.join(jasmine_root, 'spec'))
27
+ end
28
+
29
+ def self.raw_spec_files
30
+ Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js"))
31
+ end
32
+
33
+ def self.specs
34
+ Jasmine.cachebust(raw_spec_files).collect {|f| f.sub(jasmine_spec_dir, "/spec")}
35
+ end
36
+
37
+ def self.dir_mappings
38
+ {
39
+ "/src" => jasmine_src_dir,
40
+ "/spec" => jasmine_spec_dir,
41
+ "/lib" => jasmine_lib_dir
42
+ }
43
+ end
44
+ end
@@ -0,0 +1,31 @@
1
+ require 'rubygems'
2
+ require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb"))
3
+ require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder"))
4
+
5
+ jasmine_runner = if ENV['SAUCELABS'] == 'true'
6
+ require 'sauce_tunnel'
7
+ require 'selenium_config'
8
+ Jasmine::SauceLabsRunner.new(JasmineHelper.specs,
9
+ JasmineHelper.dir_mappings,
10
+ :saucelabs_config => 'saucelabs',
11
+ :saucelabs_config_file => File.expand_path(File.join(File.dirname(__FILE__), "saucelabs.yml")))
12
+ else
13
+ require "selenium_rc"
14
+ Jasmine::Runner.new(SeleniumRC::Server.new('localhost').jar_path,
15
+ JasmineHelper.specs,
16
+ JasmineHelper.dir_mappings)
17
+ end
18
+
19
+ spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
20
+
21
+ should_stop = false
22
+
23
+ Spec::Runner.configure do |config|
24
+ config.after(:suite) do
25
+ spec_builder.stop if should_stop
26
+ end
27
+ end
28
+
29
+ spec_builder.start
30
+ should_stop = true
31
+ spec_builder.declare_suites
@@ -0,0 +1,80 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2
+ "http://www.w3.org/TR/html4/loose.dtd">
3
+ <html>
4
+ <head>
5
+ <title>Jasmine Test Runner</title>
6
+
7
+ <script type="text/javascript">
8
+ // yes, really keep this here to keep us honest, but only for jasmine's own runner! [xw]
9
+ undefined = "diz be undefined yo";
10
+ </script>
11
+
12
+ <script type="text/javascript" src="../src/base.js"></script>
13
+ <script type="text/javascript" src="../src/util.js"></script>
14
+ <script type="text/javascript" src="../src/Env.js"></script>
15
+ <script type="text/javascript" src="../src/Reporter.js"></script>
16
+ <script type="text/javascript" src="../src/Block.js"></script>
17
+
18
+ <script type="text/javascript" src="../src/JsApiReporter.js"></script>
19
+ <script type="text/javascript" src="../src/Matchers.js"></script>
20
+ <script type="text/javascript" src="../src/mock-timeout.js"></script>
21
+ <script type="text/javascript" src="../src/MultiReporter.js"></script>
22
+ <script type="text/javascript" src="../src/NestedResults.js"></script>
23
+ <script type="text/javascript" src="../src/PrettyPrinter.js"></script>
24
+ <script type="text/javascript" src="../src/Queue.js"></script>
25
+ <script type="text/javascript" src="../src/Reporters.js"></script>
26
+ <script type="text/javascript" src="../src/Runner.js"></script>
27
+ <script type="text/javascript" src="../src/Spec.js"></script>
28
+ <script type="text/javascript" src="../src/Suite.js"></script>
29
+ <script type="text/javascript" src="../src/WaitsBlock.js"></script>
30
+ <script type="text/javascript" src="../src/WaitsForBlock.js"></script>
31
+
32
+ <script type="text/javascript" src="../lib/TrivialReporter.js"></script>
33
+ <script type="text/javascript" src="../lib/consolex.js"></script>
34
+
35
+
36
+
37
+ <script type="text/javascript" src="suites/CustomMatchersSpec.js"></script>
38
+ <script type="text/javascript" src="suites/EnvSpec.js"></script>
39
+ <script type="text/javascript" src="suites/ExceptionsSpec.js"></script>
40
+ <script type="text/javascript" src="suites/JsApiReporterSpec.js"></script>
41
+ <script type="text/javascript" src="suites/MatchersSpec.js"></script>
42
+ <script type="text/javascript" src="suites/MultiReporterSpec.js"></script>
43
+ <script type="text/javascript" src="suites/NestedResultsSpec.js"></script>
44
+ <script type="text/javascript" src="suites/PrettyPrintSpec.js"></script>
45
+ <script type="text/javascript" src="suites/ReporterSpec.js"></script>
46
+ <script type="text/javascript" src="suites/RunnerSpec.js"></script>
47
+ <script type="text/javascript" src="suites/QueueSpec.js"></script>
48
+ <script type="text/javascript" src="suites/SpecSpec.js"></script>
49
+ <script type="text/javascript" src="suites/SpecRunningSpec.js"></script>
50
+ <script type="text/javascript" src="suites/SpySpec.js"></script>
51
+ <script type="text/javascript" src="suites/SuiteSpec.js"></script>
52
+ <script type="text/javascript" src="suites/TrivialReporterSpec.js"></script>
53
+ <script type="text/javascript" src="suites/WaitsForBlockSpec.js"></script>
54
+
55
+
56
+ <script type="text/javascript">
57
+ (function() {
58
+ var jasmineEnv = jasmine.getEnv();
59
+ jasmineEnv.updateInterval = 1000;
60
+
61
+ var trivialReporter = new jasmine.TrivialReporter();
62
+
63
+ jasmineEnv.addReporter(trivialReporter);
64
+
65
+ jasmineEnv.specFilter = function(spec) {
66
+ return trivialReporter.specFilter(spec);
67
+ };
68
+
69
+ window.onload = function() {
70
+ jasmineEnv.execute();
71
+ };
72
+ })();
73
+ </script>
74
+
75
+ <link href="../lib/jasmine.css" rel="stylesheet"/>
76
+ </head>
77
+
78
+ <body>
79
+ </body>
80
+ </html>
@@ -0,0 +1,24 @@
1
+ local:
2
+ application_framework: :selenium
3
+ #
4
+ # Possible Sauce Labs configurations as of 2009/11/19
5
+ # From: http://saucelabs.com/products/docs/sauce-ondemand/browsers
6
+ # os: "Windows 2003"
7
+ # browser: "iexplore"
8
+ # browser-version: "6.", "7.", "8."
9
+ # browser: "firefox"
10
+ # browser-version: "2.", "3.0", "3.5"
11
+ # browser: "safari"
12
+ # browser-version: "3.", "4."
13
+ # browser: "opera"
14
+ # browser-version: "9."
15
+ # browser: "googlechrome"
16
+ # browser-version: ""
17
+ # os: "Linux"
18
+ # browser: "firefox"
19
+ # browser-version: "3."
20
+ saucelabs:
21
+ application_framework: :external
22
+ selenium_server_address: "saucelabs.com"
23
+ selenium_browser_key: '{"username": "--YOUR-SAUCELABS-USERNAME--", "access-key": "--YOUR-SAUCELABS-ACCESS-KEY--", "os": "Linux", "browser": "firefox", "browser-version": "3."}'
24
+ application_port: "80"
@@ -0,0 +1,112 @@
1
+ describe("Custom Matchers", function() {
2
+ var env;
3
+ var fakeTimer;
4
+
5
+ beforeEach(function() {
6
+ env = new jasmine.Env();
7
+ env.updateInterval = 0;
8
+ });
9
+
10
+ it("should be easy to add more matchers local to a spec, suite, etc.", function() {
11
+ var spec1, spec2, spec1Matcher, spec2Matcher;
12
+ var suite = env.describe('some suite', function() {
13
+ env.beforeEach(function() {
14
+ this.addMatchers({ matcherForSuite: function(expected) {
15
+ return "matcherForSuite: actual: " + this.actual + "; expected: " + expected;
16
+ } });
17
+ });
18
+
19
+ spec1 = env.it('spec with an expectation').runs(function () {
20
+ this.addMatchers({ matcherForSpec: function(expected) {
21
+ return "matcherForSpec: actual: " + this.actual + "; expected: " + expected;
22
+ } });
23
+ spec1Matcher = this.expect("xxx");
24
+ });
25
+
26
+ spec2 = env.it('spec with failing expectation').runs(function () {
27
+ spec2Matcher = this.expect("yyy");
28
+ });
29
+ });
30
+
31
+ suite.execute();
32
+
33
+ expect(spec1Matcher.matcherForSuite("expected")).toEqual("matcherForSuite: actual: xxx; expected: expected");
34
+ expect(spec1Matcher.matcherForSpec("expected")).toEqual("matcherForSpec: actual: xxx; expected: expected");
35
+
36
+ expect(spec2Matcher.matcherForSuite("expected")).toEqual("matcherForSuite: actual: yyy; expected: expected");
37
+ expect(spec2Matcher.matcherForSpec).toBe(jasmine.undefined);
38
+ });
39
+
40
+ it("should generate messages with the same rules as for regular matchers when this.report() is not called", function() {
41
+ var spec;
42
+ var suite = env.describe('some suite', function() {
43
+ spec = env.it('spec with an expectation').runs(function () {
44
+ this.addMatchers({
45
+ toBeTrue: function() {
46
+ return this.actual === true;
47
+ }
48
+ });
49
+ this.expect(true).toBeTrue();
50
+ this.expect(false).toBeTrue();
51
+ });
52
+ });
53
+
54
+ suite.execute();
55
+ var passResult = new jasmine.ExpectationResult({passed: true, matcherName: 'toBeTrue',
56
+ actual: true, expected: jasmine.undefined, message: "Passed." });
57
+ var failResult = new jasmine.ExpectationResult({passed: false, matcherName: 'toBeTrue',
58
+ actual: false, expected: jasmine.undefined, message: "Expected false to be true." });
59
+ failResult.trace = jasmine.any(Object);
60
+ expect(spec.results().getItems()).toEqual([passResult, failResult]);
61
+ });
62
+
63
+ it("should pass args", function() {
64
+ var matcherCallArgs = [];
65
+ var spec;
66
+ var suite = env.describe('some suite', function() {
67
+ spec = env.it('spec with an expectation').runs(function () {
68
+ this.addMatchers({
69
+ toBeTrue: function() {
70
+ matcherCallArgs.push(jasmine.util.argsToArray(arguments));
71
+ return this.actual === true;
72
+ }
73
+ });
74
+ this.expect(true).toBeTrue();
75
+ this.expect(false).toBeTrue('arg');
76
+ this.expect(true).toBeTrue('arg1', 'arg2');
77
+ });
78
+ });
79
+
80
+ suite.execute();
81
+ var results = spec.results().getItems();
82
+ expect(results[0].expected).toEqual(jasmine.undefined);
83
+ expect(results[1].expected).toEqual('arg');
84
+ expect(results[2].expected).toEqual(['arg1', 'arg2']);
85
+
86
+ expect(matcherCallArgs).toEqual([[], ['arg'], ['arg1', 'arg2']]);
87
+ });
88
+
89
+ describe("in the old style", function() {
90
+ it("should report a deprecation error", function() {
91
+ var spec;
92
+ var suite = env.describe('some suite', function() {
93
+ spec = env.it('spec with an expectation').runs(function () {
94
+ this.addMatchers({
95
+ toBeTrue: function() {
96
+ this.report(this.actual === true, this.actual + " was not true.", "details");
97
+ }
98
+ });
99
+ this.expect(true).toBeTrue();
100
+ this.expect(false).toBeTrue();
101
+ });
102
+ });
103
+
104
+ suite.execute();
105
+ var passResult = new jasmine.ExpectationResult({passed: true, message: "Passed.", details: "details"});
106
+ var failResult = new jasmine.ExpectationResult({passed: false, message: "false was not true.", details: "details"});
107
+ failResult.trace = jasmine.any(Object);
108
+ expect(spec.results().getItems()).toEqual([passResult, failResult]);
109
+ });
110
+ });
111
+
112
+ });
@@ -0,0 +1,158 @@
1
+ describe("jasmine.Env", function() {
2
+ var env;
3
+ beforeEach(function() {
4
+ env = new jasmine.Env();
5
+ env.updateInterval = 0;
6
+ });
7
+
8
+ describe('ids', function () {
9
+ it('nextSpecId should return consecutive integers, starting at 0', function () {
10
+ expect(env.nextSpecId()).toEqual(0);
11
+ expect(env.nextSpecId()).toEqual(1);
12
+ expect(env.nextSpecId()).toEqual(2);
13
+ });
14
+ });
15
+
16
+ describe("reporting", function() {
17
+ var fakeReporter;
18
+
19
+ beforeEach(function() {
20
+ fakeReporter = jasmine.createSpyObj("fakeReporter", ["log"]);
21
+ });
22
+
23
+ describe('version', function () {
24
+ var oldVersion;
25
+
26
+ beforeEach(function () {
27
+ oldVersion = jasmine.version_;
28
+ });
29
+
30
+ afterEach(function () {
31
+ jasmine.version_ = oldVersion;
32
+ });
33
+
34
+ it('should raise an error if version is not set', function () {
35
+ jasmine.version_ = null;
36
+ var exception;
37
+ try {
38
+ env.version();
39
+ }
40
+ catch (e) {
41
+ exception = e;
42
+ }
43
+ expect(exception.message).toEqual('Version not set');
44
+ });
45
+
46
+ it("version should return the current version as an int", function() {
47
+ jasmine.version_ = {
48
+ "major": 1,
49
+ "minor": 9,
50
+ "build": 7,
51
+ "revision": 8
52
+ };
53
+ expect(env.version()).toEqual({
54
+ "major": 1,
55
+ "minor": 9,
56
+ "build": 7,
57
+ "revision": 8
58
+ });
59
+ });
60
+
61
+ describe("versionString", function() {
62
+ it("should return a stringified version number", function() {
63
+ jasmine.version_ = {
64
+ "major": 1,
65
+ "minor": 9,
66
+ "build": 7,
67
+ "revision": 8
68
+ };
69
+ expect(env.versionString()).toEqual("1.9.7 revision 8");
70
+ });
71
+
72
+ it("should return a nice string when version is unknown", function() {
73
+ jasmine.version_ = null;
74
+ expect(env.versionString()).toEqual("version unknown");
75
+ });
76
+ });
77
+ });
78
+
79
+ it("should allow reporters to be registered", function() {
80
+ env.addReporter(fakeReporter);
81
+ env.reporter.log("message");
82
+ expect(fakeReporter.log).wasCalledWith("message");
83
+ });
84
+ });
85
+
86
+ describe("equality testing", function() {
87
+ describe("with custom equality testers", function() {
88
+ var aObj, bObj, isEqual;
89
+
90
+ beforeEach(function() {
91
+ env.addEqualityTester(function(a, b) {
92
+ aObj = a;
93
+ bObj = b;
94
+ return isEqual;
95
+ });
96
+ });
97
+
98
+ it("should call the custom equality tester with two objects for comparison", function() {
99
+ env.equals_("1", "2");
100
+ expect(aObj).toEqual("1");
101
+ expect(bObj).toEqual("2");
102
+ });
103
+
104
+ describe("when the custom equality tester returns false", function() {
105
+ beforeEach(function() {
106
+ isEqual = false;
107
+ });
108
+
109
+ it("should give custom equality testers precedence", function() {
110
+ expect(env.equals_('abc', 'abc')).toBeFalsy();
111
+ var o = new Object();
112
+ expect(env.equals_(o, o)).toBeFalsy();
113
+ });
114
+ });
115
+
116
+
117
+ describe("when the custom equality tester returns true", function() {
118
+ beforeEach(function() {
119
+ isEqual = true;
120
+ });
121
+
122
+ it("should give custom equality testers precedence", function() {
123
+ expect(env.equals_('abc', 'def')).toBeTruthy();
124
+ expect(env.equals_(true, false)).toBeTruthy();
125
+ });
126
+ });
127
+
128
+ describe("when the custom equality tester returns undefined", function() {
129
+ beforeEach(function() {
130
+ isEqual = jasmine.undefined;
131
+ });
132
+
133
+ it("should use normal equality rules", function() {
134
+ expect(env.equals_('abc', 'abc')).toBeTruthy();
135
+ expect(env.equals_('abc', 'def')).toBeFalsy();
136
+ });
137
+
138
+ describe("even if there are several", function() {
139
+ beforeEach(function() {
140
+ env.addEqualityTester(function(a, b) { return jasmine.undefined; });
141
+ env.addEqualityTester(function(a, b) { return jasmine.undefined; });
142
+ });
143
+
144
+ it("should use normal equality rules", function() {
145
+ expect(env.equals_('abc', 'abc')).toBeTruthy();
146
+ expect(env.equals_('abc', 'def')).toBeFalsy();
147
+ });
148
+ });
149
+ });
150
+
151
+ it("should evaluate custom equality testers in the order they are declared", function() {
152
+ isEqual = false;
153
+ env.addEqualityTester(function(a, b) { return true; });
154
+ expect(env.equals_('abc', 'abc')).toBeFalsy();
155
+ });
156
+ });
157
+ });
158
+ });