From eae0dbdc572c736852bf147ac800a71029d66696 Mon Sep 17 00:00:00 2001 From: ragaskar Date: Thu, 15 Oct 2009 01:37:53 -0700 Subject: [PATCH] Remove frozen jasmine --- jasmine/MIT.LICENSE | 20 - jasmine/README.markdown | 479 ---- jasmine/Rakefile | 94 - jasmine/contrib/ruby/jasmine_runner.rb | 249 -- jasmine/contrib/ruby/jasmine_spec_builder.rb | 146 -- jasmine/contrib/ruby/run.html | 44 - .../contrib/ruby/spec/jasmine_runner_spec.rb | 51 - jasmine/doc/files.html | 264 --- jasmine/doc/index.html | 306 --- jasmine/doc/symbols/_global_.html | 914 -------- jasmine/doc/symbols/jasmine.Block.html | 345 --- jasmine/doc/symbols/jasmine.Env.html | 390 ---- .../doc/symbols/jasmine.JsApiReporter.html | 322 --- .../doc/symbols/jasmine.MultiReporter.html | 322 --- .../doc/symbols/jasmine.NestedResults.html | 706 ------ jasmine/doc/symbols/jasmine.Reporter.html | 322 --- jasmine/doc/symbols/jasmine.Runner.html | 390 ---- jasmine/doc/symbols/jasmine.Spec.html | 345 --- jasmine/doc/symbols/jasmine.Spy.html | 851 ------- jasmine/doc/symbols/jasmine.Suite.html | 408 ---- jasmine/doc/symbols/jasmine.html | 684 ------ jasmine/doc/symbols/jasmine.util.html | 322 --- .../symbols/src/lib_TrivialReporter.js.html | 133 -- .../doc/symbols/src/lib_jasmine-0.9.0.js.html | 2042 ----------------- jasmine/doc/symbols/src/lib_json2.js.html | 486 ---- jasmine/examples/html/example_suite.html | 26 - jasmine/examples/html/spec/example_suite.js | 11 - jasmine/examples/ruby/Rakefile | 24 - .../ruby/spec/example/example_spec.js | 11 - jasmine/examples/ruby/spec/jasmine_helper.rb | 39 - jasmine/examples/ruby/spec/jasmine_spec.rb | 22 - jasmine/images/fail-16.png | Bin 722 -> 0 bytes jasmine/images/fail.png | Bin 2114 -> 0 bytes jasmine/images/go-16.png | Bin 759 -> 0 bytes jasmine/images/go.png | Bin 2303 -> 0 bytes jasmine/images/pending-16.png | Bin 802 -> 0 bytes jasmine/images/pending.png | Bin 2720 -> 0 bytes jasmine/images/question-bk.png | Bin 2541 -> 0 bytes jasmine/images/questionbk-16.png | Bin 768 -> 0 bytes jasmine/images/spinner.gif | Bin 1737 -> 0 bytes jasmine/lib/TrivialReporter.js | 125 - jasmine/lib/jasmine-0.9.0.js | 2034 ---------------- jasmine/lib/jasmine.css | 92 - jasmine/lib/json2.js | 478 ---- jasmine/spec/jasmine_helper.rb | 40 - jasmine/spec/jasmine_spec.rb | 22 - jasmine/spec/suites/EnvSpec.js | 58 - jasmine/spec/suites/ExceptionsSpec.js | 106 - jasmine/spec/suites/MatchersSpec.js | 313 --- jasmine/spec/suites/MultiReporterSpec.js | 30 - jasmine/spec/suites/NestedResultsSpec.js | 41 - jasmine/spec/suites/PrettyPrintSpec.js | 62 - jasmine/spec/suites/ReporterSpec.js | 60 - jasmine/spec/suites/RunnerSpec.js | 161 -- jasmine/spec/suites/SpecRunningSpec.js | 1100 --------- jasmine/spec/suites/SpySpec.js | 187 -- jasmine/spec/suites/SuiteSpec.js | 100 - jasmine/spec/suites/TrivialReporterSpec.js | 34 - jasmine/src/Block.js | 26 - jasmine/src/Env.js | 197 -- jasmine/src/JsApiReporter.js | 58 - jasmine/src/Matchers.js | 282 --- jasmine/src/MultiReporter.js | 28 - jasmine/src/NestedResults.js | 80 - jasmine/src/PrettyPrinter.js | 120 - jasmine/src/Queue.js | 79 - jasmine/src/Reporter.js | 27 - jasmine/src/Reporters.js | 33 - jasmine/src/Runner.js | 51 - jasmine/src/Spec.js | 189 -- jasmine/src/Suite.js | 75 - jasmine/src/WaitsBlock.js | 13 - jasmine/src/WaitsForBlock.js | 38 - jasmine/src/base.js | 514 ----- jasmine/src/mock-timeout.js | 158 -- jasmine/src/util.js | 59 - jasmine/src/version.json | 5 - 77 files changed, 17843 deletions(-) delete mode 100644 jasmine/MIT.LICENSE delete mode 100644 jasmine/README.markdown delete mode 100644 jasmine/Rakefile delete mode 100644 jasmine/contrib/ruby/jasmine_runner.rb delete mode 100644 jasmine/contrib/ruby/jasmine_spec_builder.rb delete mode 100644 jasmine/contrib/ruby/run.html delete mode 100644 jasmine/contrib/ruby/spec/jasmine_runner_spec.rb delete mode 100644 jasmine/doc/files.html delete mode 100644 jasmine/doc/index.html delete mode 100644 jasmine/doc/symbols/_global_.html delete mode 100644 jasmine/doc/symbols/jasmine.Block.html delete mode 100644 jasmine/doc/symbols/jasmine.Env.html delete mode 100644 jasmine/doc/symbols/jasmine.JsApiReporter.html delete mode 100644 jasmine/doc/symbols/jasmine.MultiReporter.html delete mode 100644 jasmine/doc/symbols/jasmine.NestedResults.html delete mode 100644 jasmine/doc/symbols/jasmine.Reporter.html delete mode 100644 jasmine/doc/symbols/jasmine.Runner.html delete mode 100644 jasmine/doc/symbols/jasmine.Spec.html delete mode 100644 jasmine/doc/symbols/jasmine.Spy.html delete mode 100644 jasmine/doc/symbols/jasmine.Suite.html delete mode 100644 jasmine/doc/symbols/jasmine.html delete mode 100644 jasmine/doc/symbols/jasmine.util.html delete mode 100644 jasmine/doc/symbols/src/lib_TrivialReporter.js.html delete mode 100644 jasmine/doc/symbols/src/lib_jasmine-0.9.0.js.html delete mode 100644 jasmine/doc/symbols/src/lib_json2.js.html delete mode 100644 jasmine/examples/html/example_suite.html delete mode 100644 jasmine/examples/html/spec/example_suite.js delete mode 100644 jasmine/examples/ruby/Rakefile delete mode 100644 jasmine/examples/ruby/spec/example/example_spec.js delete mode 100644 jasmine/examples/ruby/spec/jasmine_helper.rb delete mode 100644 jasmine/examples/ruby/spec/jasmine_spec.rb delete mode 100755 jasmine/images/fail-16.png delete mode 100755 jasmine/images/fail.png delete mode 100644 jasmine/images/go-16.png delete mode 100644 jasmine/images/go.png delete mode 100755 jasmine/images/pending-16.png delete mode 100755 jasmine/images/pending.png delete mode 100755 jasmine/images/question-bk.png delete mode 100755 jasmine/images/questionbk-16.png delete mode 100755 jasmine/images/spinner.gif delete mode 100644 jasmine/lib/TrivialReporter.js delete mode 100644 jasmine/lib/jasmine-0.9.0.js delete mode 100644 jasmine/lib/jasmine.css delete mode 100644 jasmine/lib/json2.js delete mode 100755 jasmine/spec/jasmine_helper.rb delete mode 100644 jasmine/spec/jasmine_spec.rb delete mode 100644 jasmine/spec/suites/EnvSpec.js delete mode 100644 jasmine/spec/suites/ExceptionsSpec.js delete mode 100644 jasmine/spec/suites/MatchersSpec.js delete mode 100644 jasmine/spec/suites/MultiReporterSpec.js delete mode 100644 jasmine/spec/suites/NestedResultsSpec.js delete mode 100644 jasmine/spec/suites/PrettyPrintSpec.js delete mode 100644 jasmine/spec/suites/ReporterSpec.js delete mode 100644 jasmine/spec/suites/RunnerSpec.js delete mode 100644 jasmine/spec/suites/SpecRunningSpec.js delete mode 100644 jasmine/spec/suites/SpySpec.js delete mode 100644 jasmine/spec/suites/SuiteSpec.js delete mode 100644 jasmine/spec/suites/TrivialReporterSpec.js delete mode 100644 jasmine/src/Block.js delete mode 100644 jasmine/src/Env.js delete mode 100644 jasmine/src/JsApiReporter.js delete mode 100644 jasmine/src/Matchers.js delete mode 100644 jasmine/src/MultiReporter.js delete mode 100644 jasmine/src/NestedResults.js delete mode 100644 jasmine/src/PrettyPrinter.js delete mode 100644 jasmine/src/Queue.js delete mode 100644 jasmine/src/Reporter.js delete mode 100644 jasmine/src/Reporters.js delete mode 100644 jasmine/src/Runner.js delete mode 100644 jasmine/src/Spec.js delete mode 100644 jasmine/src/Suite.js delete mode 100644 jasmine/src/WaitsBlock.js delete mode 100644 jasmine/src/WaitsForBlock.js delete mode 100755 jasmine/src/base.js delete mode 100755 jasmine/src/mock-timeout.js delete mode 100644 jasmine/src/util.js delete mode 100644 jasmine/src/version.json diff --git a/jasmine/MIT.LICENSE b/jasmine/MIT.LICENSE deleted file mode 100644 index 36e0598..0000000 --- a/jasmine/MIT.LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2008 Pivotal Labs - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/jasmine/README.markdown b/jasmine/README.markdown deleted file mode 100644 index 9b23c2c..0000000 --- a/jasmine/README.markdown +++ /dev/null @@ -1,479 +0,0 @@ -Jasmine -======= -**YET ANOTHER JavaScript testing framework** - -Quick Start ----------- - -### Ruby Suite Running - - sudo gem sources -a http://gems.github.com - sudo gem install json thin - git clone git://github.com/pivotal/jasmine.git - cd jasmine/examples/ruby - rake jasmine_server - -open `http://localhost:8888/` in your favorite browser. - -### HTML Suite Running - - git clone git://github.com/pivotal/jasmine.git - -open `examples/test/html/example_suite.html` in your favorite browser. - -### Automatic Suite Running (w/ Selenium) - - sudo gem sources -a http://gems.github.com - sudo gem install json thin pivotal-selenium-rc selenium-client - git clone git://github.com/pivotal/jasmine.git - cd jasmine/examples/ruby - rake test:ci - -Releases ----------- -0.9.0 beta [[download]](http://github.com/pivotal/jasmine/zipball/master) -`git clone git://github.com/pivotal/jasmine.git` - -0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0) - -### Which Release Should I Use? - -Please use the latest version unless you have a good reason not to. Some of this documentation may not be applicable to older versions. - - -Why Another Frickin' JS TDD/BDD Framework? ------------ - -There are some situations when you want to test-drive JavaScript, but you don't want to be bothered with or even have an explicit document. You have no DOM to work with and thus lack HTML elements on which to hang event handlers. You may need to make asynchronous calls (say, to an AJAX API) and cannot mock/stub them. - -But you still need to write tests. - -What's an Agile Engineer to do? - -Enter Jasmine ------------- - -Jasmine is yet another JavaScript testing framework. It's *heavily* influenced by JSSpec, ScrewUnit & [JSpec](http://github.com/visionmedia/jspec/tree/master), which are all influenced by RSpec. But each of those was lacking in some way: JSSpec & ScrewUnit require a DOM. JSpec's DOM-less assumption was a great start, but it needed asynchronous support. - -So we started over. And TDD'd a whole new framework. Enjoy. - -How To ------- - -There is a nice example of how to use Jasmine in the /example directory. But here's more information. - -Exciting changes are afoot and many syntax changes have been made to make Jasmine more usable. Please read the examples below for updates. - -### Specs - -Each spec is, naturally, a JavaScript function. You tell Jasmine about this spec with a call to `it()` with a string and the function. The string is a description that will be helpful to you when reading a report. - - it('should be a test', function () { - var foo = 0 - foo++; - }); - -### Expectations - -Within your spec you will want/need to make expectations. These are made with the `expect()` funciton and expectation matchers. like this: - - it('should be a test', function () { - var foo = 0 - foo++; - - expect(foo).toEqual(1); - }); - -Results of the expectations are logged for later for reporting. - -#### Expectation Matchers - -Jasmine has several built-in matchers. Here are a few: - -`toEqual()` compares objects or primitives and returns true if they are equal - -`toNotEqual()` compares objects or primitives and returns true if they are not equal - -`toMatch()` takes a regex or a string and returns true if it matches - -`toNotMatch()` takes a regex or a string and returns true if it does not match - -`toBeDefined()` returns true if the object or primitive is not `undefined` - -`toBeNull()` returns true if the object or primitive is not `null` - -`toBeTruthy()` returns true if the object or primitive evaluates to true - -`toBeFalsy()` returns true if the object or primitive evaluates to false - -`toContain()` returns true if an array or string contains the passed variable. - -`toNotContain()` returns true if an array or string does not contain the passed variable. - -#### Writing New Matchers - -A Matcher has a method name, takes an expected value as it's only parameter, has access to the actual value in this, and then makes a call to this.report with true/false with a failure message. Here's the definition of `toEqual()`: - - Jasmine.Matchers.prototype.toEqual = function (expected) { - return this.report((this.actual === expected), - 'Expected ' + expected + ' but got ' + this.actual + '.'); - }); - -Feel free to define your own matcher as needed in your code. If you'd like to add Matchers to Jasmine, please write tests. - -### Asynchronous Specs - -You may be thinking, "That's all well and good, but you mentioned something about asynchronous tests." - -Well, say you need to make a call that is asynchronous - an AJAX API, or some other JavaScript library. That is, the call returns immediately, yet you want to make expectations 'at some point in the future' after some magic happens in the background. - -Jasmine allows you to do this with `runs()` and `waits()` blocks. - -`runs()` blocks by themselves simply run as if they were called directly. The following snippets of code should provide similar results: - - it('should be a test', function () { - var foo = 0 - foo++; - - expect(foo).toEqual(1); - }); - -and - - it('should be a test', function () { - runs( function () { - var foo = 0 - foo++; - - expect(foo).toEqual(1); - }); - }); - -multiple `runs()` blocks in a spec will run serially. For example, - - it('should be a test', function () { - runs( function () { - var foo = 0 - foo++; - - expect(foo).toEqual(1); - }); - runs( function () { - var bar = 0 - bar++; - - expect(bar).toEqual(1); - }); - }); - -`runs()` blocks share functional scope -- `this` properties will be common to all blocks, but declared `var`'s will not! - - it('should be a test', function () { - runs( function () { - this.foo = 0 - this.foo++; - var bar = 0; - bar++; - - expect(this.foo).toEqual(1); - expect(bar).toEqual(1); - }); - runs( function () { - this.foo++; - var bar = 0 - bar++; - - expect(foo).toEqual(2); - expect(bar).toEqual(1); - }); - }); - -`runs()` blocks exist so you can test asynchronous processes. The function `waits()` works with `runs()` to provide a naive -timeout before the next block is run. You supply a time to wait before the next `runs()` function is executed. For example: - - it('should be a test', function () { - runs(function () { - this.foo = 0; - var that = this; - setTimeout(function () { - that.foo++; - }, 250); - }); - - runs(function () { - this.expects(this.foo).toEqual(0); - }); - - waits(500); - - runs(function () { - this.expects(this.foo).toEqual(1); - }); - }); - -What's happening here? - -* The first call to `runs()` sets call for 1/4 of a second in the future that increments `this.foo`. -* The second `runs()` is executed immediately and then verifies that `this.foo` was indeed initialized to zero in the previous `runs()`. -* Then we wait for half a second. -* Then the last call to `runs()` expects that `this.foo` was incremented by the `setTimeout`. - - -### Suites - -Specs are grouped in Suites. Suites are defined using the global `describe()` function: - - describe('One suite', function () { - it('has a test', function () { - ... - }); - - it('has another test', function () { - ... - }); - }); - -The Suite name is so that reporting is more descriptive. - -Suites are executed in the order in which `describe()` calls are made, usually in the order in which their script files are included. Additionally, specs within a suite share a functional scope. So you may declare variables inside a describe block and they are accessible from within your specs. For example: - - describe('A suite with some variables', function () { - var bar = 0 - - it('has a test', function () { - bar++; - expect(bar).toEqual(1); - }); - - it('has another test', function () { - bar++; - expect(bar).toEqual(2); - }); - }); - -#### beforeEach - -A suite can have a beforeEach declaration. It takes a function that is run before each spec. For example: - - describe('some suite', function () { - - var suiteWideFoo; - - beforeEach(function () { - suiteWideFoo = 1; - } - - it('should equal bar', function () { - expect(suiteWideFoo).toEqual(1); - }; - }); - -#### afterEach - -Similarly, there is an afterEach declaration. It takes a function that is run after each spec. For example: - - describe('some suite', function () { - - var suiteWideFoo; - afterEach(function () { - suiteWideFoo = 0; - } - - it('should equal 1', function () { - expect(suiteWideFoo).toEqual(1); - }; - - it('should equal 0 after', function () { - expect(suiteWideFoo).toEqual(0); - }; - }); - -### Nested Describes -Jasmine supports nested describes. An example: - - describe('some suite', function () { - - var suiteWideFoo; - - beforeEach(function () { - suiteWideFoo = 0; - }); - - describe('some nested suite', function() { - var nestedSuiteBar; - beforeEach(function() { - nestedSuiteBar=1; - }); - - it('nested expectation', function () { - expect(suiteWideFoo).toEqual(0); - expect(nestedSuiteBar).toEqual(1); - }; - - }); - - it('top-level describe', function () { - expect(suiteWideFoo).toEqual(0); - expect(nestedSuiteBar).toEqual(undefined); - }; - }); - -### Spies - -Jasmine integrates 'spies' that permit many spying, mocking, and faking behaviors. - -Here are a few examples: - - var Klass = function () { - } - - var Klass.prototype.method = function (arg) { - return arg; - } - - var Klass.prototype.methodWithCallback = function (callback) { - return callback('foo'); - } - - ... - - it('should spy on Klass#method') { - spyOn(Klass, 'method'); - Klass.method('foo argument'); - - expect(Klass.method).wasCalledWith('foo argument'); - }); - - it('should spy on Klass#methodWithCallback') { - var callback = Jasmine.createSpy(); - Klass.method(callback); - - expect(callback).wasCalledWith('foo'); - }); - - -Spies can be very useful for testing AJAX or other asynchronous behaviors that take callbacks by faking the method firing an async call. - - var Klass = function () { - }; - - var Klass.prototype.asyncMethod = function (callback) { - someAsyncCall(callback); - }; - - ... - - it('should test async call') { - spyOn(Klass, 'asyncMethod'); - var callback = Jasmine.createSpy(); - - Klass.asyncMethod(callback); - expect(callback).wasNotCalled(); - - var someResponseData = 'foo'; - Klass.asyncMethod.mostRecentCall.args[0](someResponseData); - expect(callback).wasCalledWith(someResponseData); - - }); - -There are spy-specfic matchers that are very handy. - -`wasCalled()` returns true if the object is a spy and was called - -`wasCalledWith(arguments)` returns true if the object is a spy and was called with the passed arguments - -`wasNotCalled()` returns true if the object is a spy and was not called - -`wasNotCalledWith(arguments)` returns true if the object is a spy and was not called with the passed arguments - -Spies can be trained to respond in a variety of ways when invoked: - -`andCallThrough()`: spies on AND calls the original function spied on - -`andReturn(arguments)`: returns passed arguments when spy is called - -`andThrow(exception)`: throws passed exception when spy is called - -`andCallFake(function)`: calls passed function when spy is called - -Spies have some useful properties: - -`callCount`: returns number of times spy was called - -`mostRecentCall.args`: returns argument array from last call to spy. - -`argsForCall[i]` returns arguments array for call `i` to spy. - -Spies are automatically removed after each spec. They may be set in the beforeEach function. - -### Runner - -You don't need a DOM to run your tests, but you do need a page on which to load & execute your JS. Include the `jasmine.js` file in a script tag as well as the JS file with your specs. You can also use this page for reporting. More on that in a moment. - -Here's the example HTML file (in `jasmine/example`): - - - - - Jasmine Example - - - - - -

- Running Jasmine Example Specs -

-
- - - - -It's the call to `jasmine.execute()` that runs all of the defined specs, gathering reports of each expectation. - -### Reports - -If a reporter exists on the Jasmine instance (named `jasmine`), it will be called when each spec, suite and the overall runner complete. If you're at the single-spec result level, you'll get a spec description, whether it passed or failed, and what the failure message was. At the suite & runner report level, you'll get the total specs run so far, the passed counts, failed counts, and a description (of the suite or runner). - -There is a `Jasmine.Reporters` namespace for you to see how to handle reporting. See the file `json_reporter.js`, which takes the results objects and turns them into JSON strings, for two examples of how to make the results callbacks work for you. - - -### Disabling Tests & Suites - -Specs may be disabled by calling `xit()` instead of `it()`. Suites may be disabled by calling `xdescribe()` instead of `describe()`. A simple find/replace in your editor of choice will allow you to run a subset of your specs. - -Contributing and Tests ----------------------- - -Sometimes it's hard to test a framework with the framework itself. Either the framework isn't mature enough or it just hurts your head. Jasmine is affected by both. - -So we made a little bootstrappy test reporter that lets us test Jasmine's pieces in isolation. See test/bootstrap.js. Feel free to use the bootstrap test suite to test your custom Matchers or extensions/changes to Jasmine. - -Your contributions are welcome. Please submit tests with your pull request. - -## Support -We now have a Google Group for support & discussion. - -* Homepage: [http://groups.google.com/group/jasmine-js](http://groups.google.com/group/jasmine-js) -* Group email: [jasmine-js@googlegroups.com](jasmine-js@googlegroups.com) - -## Maintainers - -* [Davis W. Frank](mailto:dwfrank@pivotallabs.com), Pivotal Labs -* [Rajan Agaskar](mailto:rajan@pivotallabs.com), Pivotal Labs - -## Acknowledgments -* A big shout out to the various JavaScript test framework authors, especially TJ for [JSpec](http://github.com/visionmedia/jspec/tree/master) - we played with it a bit before deciding that we really needed to roll our own. -* Thanks to Pivot [Jessica Miller](http://www.jessicamillerworks.com/) for our fancy pass/fail/pending icons -* Huge contributions have been made by [Christian Williams](mailto:xian@pivotallabs.com) (the master "spy" coder), [Erik Hanson](mailto:erik@pivotallabs.com), [Adam Abrons](mailto:adam@pivotallabs.com) and [Carl Jackson](mailto:carl@pivotallabs.com), and many other Pivots. - -## TODO List - -* Pending & Disabled counts should be included in results diff --git a/jasmine/Rakefile b/jasmine/Rakefile deleted file mode 100644 index 767a100..0000000 --- a/jasmine/Rakefile +++ /dev/null @@ -1,94 +0,0 @@ -require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb")) - -def jasmine_sources - sources = ["src/base.js", "src/util.js", "src/Env.js", "src/Reporter.js", "src/Block.js"] - sources += Dir.glob('src/*.js').reject{|f| f == 'src/base.js' || sources.include?(f)}.sort -end - -def jasmine_filename(version) - "jasmine-#{version['major']}.#{version['minor']}.#{version['build']}.js" -end - -def version_hash - JSON.parse(File.new("src/version.json").read); -end - -def start_jasmine_server(jasmine_includes = nil) - require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder")) - - puts "your tests are here:" - puts " http://localhost:8888/run.html" - - Jasmine::SimpleServer.start(8888, - lambda { JasmineHelper.spec_file_urls }, - JasmineHelper.dir_mappings, - jasmine_includes) -end - -namespace :jasmine do - desc 'Builds lib/jasmine from source' - task :build => 'jasmine:doc' do - puts 'Building Jasmine from source' - require 'json' - sources = jasmine_sources - version = version_hash - old_jasmine_files = Dir.glob('lib/jasmine*.js') - old_jasmine_files.each do |file| - File.delete(file) - end - jasmine = File.new("lib/#{jasmine_filename version}", 'w') - jasmine.puts(File.read(sources.shift)) - jasmine.puts %{ -jasmine.version_= { - "major": #{version['major']}, - "minor": #{version['minor']}, - "build": #{version['build']}, - "revision": #{Time.now.to_i} - }; -} - sources.each do |source_filename| - jasmine.puts(File.read(source_filename)) - end - jasmine.close - end - - desc "Build jasmine documentation" - task :doc do - puts 'Creating Jasmine Documentation' - require 'rubygems' - #sudo gem install ragaskar-jsdoc_helper - require 'jsdoc_helper' - - - JsdocHelper::Rake::Task.new(:lambda_jsdoc) - Rake::Task[:lambda_jsdoc].invoke - end - - - desc "Run jasmine tests of source via server" - task :server do - jasmine_includes = lambda { jasmine_sources + ['lib/TrivialReporter.js'] } - start_jasmine_server(jasmine_includes) - end - - desc "Build jasmine and run tests via server" - task :server_build => 'jasmine:build' do - - start_jasmine_server - end - - namespace :test do - desc "Run continuous integration tests" - task :ci => 'jasmine:build' do - require "spec" - require 'spec/rake/spectask' - Spec::Rake::SpecTask.new(:lambda_ci) do |t| - t.spec_opts = ["--color", "--format", "specdoc"] - t.spec_files = ["spec/jasmine_spec.rb"] - end - Rake::Task[:lambda_ci].invoke - end - - end - -end \ No newline at end of file diff --git a/jasmine/contrib/ruby/jasmine_runner.rb b/jasmine/contrib/ruby/jasmine_runner.rb deleted file mode 100644 index 61ff5e0..0000000 --- a/jasmine/contrib/ruby/jasmine_runner.rb +++ /dev/null @@ -1,249 +0,0 @@ -require 'socket' -require 'erb' -require 'json' - -module Jasmine - def self.root - File.expand_path(File.join(File.dirname(__FILE__), '../..')) - end - - # this seemingly-over-complex method is necessary to get an open port on at least some of our Macs - def self.open_socket_on_unused_port - infos = Socket::getaddrinfo("localhost", nil, Socket::AF_UNSPEC, Socket::SOCK_STREAM, 0, Socket::AI_PASSIVE) - families = Hash[*infos.collect { |af, *_| af }.uniq.zip([]).flatten] - - return TCPServer.open('0.0.0.0', 0) if families.has_key?('AF_INET') - return TCPServer.open('::', 0) if families.has_key?('AF_INET6') - return TCPServer.open(0) - end - - def self.find_unused_port - socket = open_socket_on_unused_port - port = socket.addr[1] - socket.close - port - end - - def self.server_is_listening_on(hostname, port) - require 'socket' - begin - socket = TCPSocket.open(hostname, port) - rescue Errno::ECONNREFUSED - return false - end - socket.close - true - end - - def self.wait_for_listener(port, name = "required process", seconds_to_wait = 10) - time_out_at = Time.now + seconds_to_wait - until server_is_listening_on "localhost", port - sleep 0.1 - puts "Waiting for #{name} on #{port}..." - raise "#{name} didn't show up on port #{port} after #{seconds_to_wait} seconds." if Time.now > time_out_at - end - end - - def self.kill_process_group(process_group_id, signal="TERM") - Process.kill signal, -process_group_id # negative pid means kill process group. (see man 2 kill) - end - - def self.cachebust(files, root_dir="", replace=nil, replace_with=nil) - files.collect do |file_name| - real_file_name = replace && replace_with ? file_name.sub(replace, replace_with) : file_name - begin - digest = Digest::MD5.hexdigest(File.read("#{root_dir}#{real_file_name}")) - rescue - digest = "MISSING-FILE" - end - "#{file_name}?cachebust=#{digest}" - end - end - - class RunAdapter - def initialize(spec_files_or_proc, jasmine_files = nil) - @spec_files_or_proc = spec_files_or_proc - @jasmine_files = jasmine_files || [ - "/__JASMINE_ROOT__/lib/" + File.basename(Dir.glob("#{Jasmine.root}/lib/jasmine*.js").first), - "/__JASMINE_ROOT__/lib/TrivialReporter.js", - "/__JASMINE_ROOT__/lib/json2.js" - ] - end - - def call(env) - spec_files = @spec_files_or_proc - spec_files = spec_files.call if spec_files.respond_to?(:call) - - jasmine_files = @jasmine_files - jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call) - - css_files = ["/__JASMINE_ROOT__/lib/jasmine.css"] - - body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding) - [ - 200, - { 'Content-Type' => 'text/html' }, - body - ] - end - end - - class Redirect - def initialize(url) - @url = url - end - - def call(env) - [ - 302, - { 'Location' => @url }, - [] - ] - end - end - - class JsAlert - def call(env) - [ - 200, - { 'Content-Type' => 'application/javascript' }, - "document.write('

Couldn\\'t load #{env["PATH_INFO"]}!

');" - ] - end - end - - class SimpleServer - def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil) - require 'thin' - - config = { - '/run.html' => Jasmine::Redirect.new('/'), - '/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files) - } - mappings.each do |from, to| - config[from] = Rack::File.new(to) - end - - config["/__JASMINE_ROOT__"] = Rack::File.new(Jasmine.root) - - app = Rack::Cascade.new([ - Rack::URLMap.new(config), - JsAlert.new - ]) - - Thin::Server.start('0.0.0.0', port, app) - end - end - - class SimpleClient - def initialize(selenium_host, selenium_port, selenium_browser_start_command, http_address) - require 'selenium/client' - @driver = Selenium::Client::Driver.new( - selenium_host, - selenium_port, - selenium_browser_start_command, - http_address - ) - @http_address = http_address - end - - def tests_have_finished? - @driver.get_eval("window.jasmine.getEnv().currentRunner.finished") == "true" - end - - def connect - @driver.start - @driver.open("/") - end - - def disconnect - @driver.stop - end - - def run - until tests_have_finished? do - sleep 0.1 - end - - puts @driver.get_eval("window.getResults()") - failed_count = @driver.get_eval("window.jasmine.getEnv().currentRunner.getResults().failedCount").to_i - failed_count == 0 - end - - def eval_js(script) - escaped_script = "'" + script.gsub(/(['\\])/) { '\\' + $1 } + "'" - - begin - result = @driver.get_eval("window.eval(#{escaped_script})") - rescue Selenium::CommandError - result = @driver.get_eval("eval(#{escaped_script}, window)") - end - JSON.parse("[#{result}]")[0] - end - end - - class Runner - def initialize(selenium_jar_path, spec_files, dir_mappings, jasmine_files = nil) - @selenium_jar_path = selenium_jar_path - @spec_files = spec_files - @dir_mappings = dir_mappings - @jasmine_files = jasmine_files - - @selenium_pid = nil - @jasmine_server_pid = nil - end - - def start - start_servers - @client = Jasmine::SimpleClient.new("localhost", @selenium_server_port, "*firefox", "http://localhost:#{@jasmine_server_port}/") - @client.connect - end - - def stop - @client.disconnect - stop_servers - end - - def start_servers - @jasmine_server_port = Jasmine::find_unused_port - @selenium_server_port = Jasmine::find_unused_port - - @selenium_pid = fork do - Process.setpgrp - exec "java -jar #{@selenium_jar_path} -port #{@selenium_server_port} > /dev/null 2>&1" - end - puts "selenium started. pid is #{@selenium_pid}" - - @jasmine_server_pid = fork do - Process.setpgrp - Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files) - exit! 0 - end - puts "jasmine server started. pid is #{@jasmine_server_pid}" - - Jasmine::wait_for_listener(@selenium_server_port, "selenium server") - Jasmine::wait_for_listener(@jasmine_server_port, "jasmine server") - end - - def stop_servers - puts "shutting down the servers..." - Jasmine::kill_process_group(@selenium_pid) if @selenium_pid - Jasmine::kill_process_group(@jasmine_server_pid) if @jasmine_server_pid - end - - def run - begin - start - puts "servers are listening on their ports -- running the test script..." - tests_passed = @client.run - ensure - stop - end - return tests_passed - end - - def eval_js(script) - @client.eval_js(script) - end - end -end diff --git a/jasmine/contrib/ruby/jasmine_spec_builder.rb b/jasmine/contrib/ruby/jasmine_spec_builder.rb deleted file mode 100644 index 4a6e902..0000000 --- a/jasmine/contrib/ruby/jasmine_spec_builder.rb +++ /dev/null @@ -1,146 +0,0 @@ -require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_runner.rb")) - -module Jasmine - - class SpecBuilder - attr_accessor :suites - - def initialize(spec_files, runner) - @spec_files = spec_files - @runner = runner - end - - def start - guess_example_locations - - @runner.start - load_suite_info - @spec_results = {} - end - - def stop - @runner.stop - end - - def script_path - File.expand_path(__FILE__) - end - - def guess_example_locations - @example_locations = {} - - example_name_parts = [] - previous_indent_level = 0 - @spec_files.each do |filename| - line_number = 1 - File.open(filename, "r") do |file| - file.readlines.each do |line| - match = /^(\s*)(describe|it)\s*\(\s*["'](.*)["']\s*,\s*function/.match(line) - if (match) - indent_level = match[1].length / 2 - example_name = match[3] - example_name_parts[indent_level] = example_name - - full_example_name = example_name_parts.slice(0, indent_level + 1).join(" ") - @example_locations[full_example_name] = "#{filename}:#{line_number}: in `it'" - end - line_number += 1 - end - end - end - end - - def load_suite_info - started = Time.now - while !eval_js('jsApiReporter && jsApiReporter.started') do - raise "couldn't connect to Jasmine after 60 seconds" if (started + 60 < Time.now) - sleep 0.1 - end - - @suites = eval_js('JSON.stringify(jsApiReporter.suites)') - end - - def results_for(spec_id) - spec_id = spec_id.to_s - return @spec_results[spec_id] if @spec_results[spec_id] - - @spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.results[#{spec_id}])") - while @spec_results[spec_id].nil? do - sleep 0.1 - @spec_results[spec_id] = eval_js("JSON.stringify(jsApiReporter.results[#{spec_id}])") - end - - @spec_results[spec_id] - end - - def declare_suites - me = self - suites.each do |suite| - declare_suite(self, suite) - end - end - - def declare_suite(parent, suite) - me = self - parent.describe suite["name"] do - suite["children"].each do |suite_or_spec| - type = suite_or_spec["type"] - if type == "suite" - me.declare_suite(self, suite_or_spec) - elsif type == "spec" - me.declare_spec(self, suite_or_spec) - else - raise "unknown type #{type} for #{suite_or_spec.inspect}" - end - end - end - end - - def declare_spec(parent, spec) - me = self - example_name = spec["name"] - - backtrace = @example_locations[parent.description + " " + example_name] - parent.it example_name, {}, backtrace do - me.report_spec(spec["id"]) - end - end - - def report_spec(spec_id) - spec_results = results_for(spec_id) - - out = "" - messages = spec_results['messages'].each do |message| - case - when message["type"] == "MessageResult" - puts message["text"] - puts "\n" - else - unless message["message"] =~ /^Passed.$/ - STDERR << message["message"] - STDERR << "\n" - - out << message["message"] - out << "\n" - end - - unless message["passed_"] - stack_trace = message["trace"]["stack"].gsub(/
/, "\n").gsub(/<\/?b>/, " ") - STDERR << stack_trace.gsub(/\(.*\)@http:\/\/localhost:[0-9]+\/specs\//, "/spec/") - STDERR << "\n" - end - end - - end - fail out unless spec_results['result'] == 'passed' - puts out unless out.empty? - end - - private - - def eval_js(js) - @runner.eval_js(js) - end - end -end - \ No newline at end of file diff --git a/jasmine/contrib/ruby/run.html b/jasmine/contrib/ruby/run.html deleted file mode 100644 index f11b042..0000000 --- a/jasmine/contrib/ruby/run.html +++ /dev/null @@ -1,44 +0,0 @@ - - - - - Jasmine suite - <% css_files.each do |css_file| %> - - <% end %> - - <% jasmine_files.each do |jasmine_file| %> - - <% end %> - - - - <% spec_files.each do |spec_file| %> - - <% end %> - - - -
- - diff --git a/jasmine/contrib/ruby/spec/jasmine_runner_spec.rb b/jasmine/contrib/ruby/spec/jasmine_runner_spec.rb deleted file mode 100644 index 20484ef..0000000 --- a/jasmine/contrib/ruby/spec/jasmine_runner_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -require 'spec' -require 'open-uri' -require File.dirname(__FILE__) + '/../jasmine_runner' - -describe Jasmine::SimpleServer do - before do - @port = Jasmine::find_unused_port - end - - after do - Jasmine::kill_process_group(@jasmine_server_pid) if @jasmine_server_pid - end - - it "should start and print script tags" do - @jasmine_server_pid = fork do - Process.setpgrp - Jasmine::SimpleServer.start(@port, ["file1", "file2"], {}) - exit! 0 - end - - Jasmine::wait_for_listener(@port) - - run_html = open("http://localhost:#{@port}/").read - run_html.should =~ / - - - - - - - - - - - - - diff --git a/jasmine/examples/html/spec/example_suite.js b/jasmine/examples/html/spec/example_suite.js deleted file mode 100644 index 494539e..0000000 --- a/jasmine/examples/html/spec/example_suite.js +++ /dev/null @@ -1,11 +0,0 @@ -describe('ExampleSuite', function () { - it('should have a passing test', function() { - expect(true).toEqual(true); - }); - - describe('Nested Describe', function () { - it('should also have a passing test', function () { - expect(true).toEqual(true); - }); - }); -}); \ No newline at end of file diff --git a/jasmine/examples/ruby/Rakefile b/jasmine/examples/ruby/Rakefile deleted file mode 100644 index f1d9063..0000000 --- a/jasmine/examples/ruby/Rakefile +++ /dev/null @@ -1,24 +0,0 @@ -require File.expand_path(File.join(File.dirname(__FILE__), "spec/jasmine_helper.rb")) - -namespace :test do - desc "Run continuous integration tests" - require "spec" - require 'spec/rake/spectask' - - Spec::Rake::SpecTask.new(:ci) do |t| - t.spec_opts = ["--color", "--format", "specdoc"] - t.spec_files = ["spec/jasmine_spec.rb"] - end -end - -desc "Run specs via server" -task :jasmine_server do - require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder")) - - puts "your tests are here:" - puts " http://localhost:8888/run.html" - - Jasmine::SimpleServer.start(8888, - lambda { JasmineHelper.spec_file_urls }, - JasmineHelper.dir_mappings) -end diff --git a/jasmine/examples/ruby/spec/example/example_spec.js b/jasmine/examples/ruby/spec/example/example_spec.js deleted file mode 100644 index 494539e..0000000 --- a/jasmine/examples/ruby/spec/example/example_spec.js +++ /dev/null @@ -1,11 +0,0 @@ -describe('ExampleSuite', function () { - it('should have a passing test', function() { - expect(true).toEqual(true); - }); - - describe('Nested Describe', function () { - it('should also have a passing test', function () { - expect(true).toEqual(true); - }); - }); -}); \ No newline at end of file diff --git a/jasmine/examples/ruby/spec/jasmine_helper.rb b/jasmine/examples/ruby/spec/jasmine_helper.rb deleted file mode 100644 index 84e01fe..0000000 --- a/jasmine/examples/ruby/spec/jasmine_helper.rb +++ /dev/null @@ -1,39 +0,0 @@ -class JasmineHelper - def self.jasmine_lib_dir - File.expand_path(File.join(jasmine_root, 'lib')) - end - - def self.jasmine_root - File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..')) - end - - def self.jasmine - ['/lib/' + File.basename(Dir.glob("#{JasmineHelper.jasmine_lib_dir}/jasmine*.js").first)] + - ['/lib/json2.js', - '/lib/TrivialReporter.js'] - end - - def self.jasmine_src_dir - File.expand_path(File.join(jasmine_root, 'src')) - end - - def self.jasmine_spec_dir - File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec')) - end - - def self.raw_spec_files - Dir.glob(File.join(jasmine_spec_dir, "**/*[Ss]pec.js")) - end - - def self.spec_file_urls - raw_spec_files.collect {|f| f.sub(jasmine_spec_dir, "/spec")} - end - - def self.dir_mappings - { - "/src" => jasmine_src_dir, - "/spec" => jasmine_spec_dir, - "/lib" => jasmine_lib_dir - } - end -end diff --git a/jasmine/examples/ruby/spec/jasmine_spec.rb b/jasmine/examples/ruby/spec/jasmine_spec.rb deleted file mode 100644 index 872fc75..0000000 --- a/jasmine/examples/ruby/spec/jasmine_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'rubygems' -require "selenium_rc" -require File.expand_path(File.join(File.dirname(__FILE__), "jasmine_helper.rb")) -require File.expand_path(File.join(JasmineHelper.jasmine_root, "contrib/ruby/jasmine_spec_builder")) - -jasmine_runner = Jasmine::Runner.new(SeleniumRC::Server.new.jar_path, - JasmineHelper.spec_file_urls, - JasmineHelper.dir_mappings) - -spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner) - -should_stop = false - -Spec::Runner.configure do |config| - config.after(:suite) do - spec_builder.stop if should_stop - end -end - -spec_builder.start -should_stop = true -spec_builder.declare_suites diff --git a/jasmine/images/fail-16.png b/jasmine/images/fail-16.png deleted file mode 100755 index 6ebbf329e5a8f786264e03b17329d40c3f6fe495..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 722 zcmV;@0xkWCP)JVde(kg!hGhha zf`FijEb6!*dN9t#gGAzZ@!|!3fC(`!M~6S4{s0q*T+o(eu;MtkMtD*yuQ&ne6G1M zmixZ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_`9 zqF0erpQ$4o-+&-V5JVRQvU+gb*P{xigTf(`2bYK08a0S%TCl;IKew+1rs(6%^#H%mf1t4}0Bv zc2uP3W|A*1 zheXVP6OZy6GX33i9@_?RqaC-`iG)#^OU1JsuPmAHZNt?rg5l zRx;0p6$ukc)nbgh=rLn@Z?X)LDFGu2C0HFF8N@Qc6PUyPV!C|*x%k~YahEdTKjFtge1 z0i-jy@zz!Jw-Dt-fpcJany-Jd6pK`Jx9(yfTeKMPxT8P()=8DKEF?2&N}cSQNw-yA z?5oKVL=pC2KQzUI?(-L%pz+^#KR|9HjuFZi#qz@6&I!B)Y@K(@B2Eme)D?%{-L9puRubM%Z~*TDpA?E^g2 z?ZM%`E|_HWZ{ME7S}s3Hu-98!AFeXQ+TRYGlRmo9O$}-|c66Sag zUfBh|S3$rllW}d^`-e0S`DpPW+nkx&Z#%4&U8Gk@MP?>KN7SQ%u08Kz18}w$C_^sN zfIN!ijKD<_lw7+%=IzyW2AW7}`sL~+)s6sHq|Kao(C3{B5A}ym^r&F^-AYLoG~8a> zz@61~2Fg|?XBut7v<18ao^3Erjs&_U5Ba;)KGJV@ojEnrPga*wX$HwY{k3{V^~ivC sdK8rQnZtE%Vbj-0vzv#F%Kroy0IDrmV=}&Ad;kCd07*qoM6N<$g6kmwMF0Q* diff --git a/jasmine/images/go-16.png b/jasmine/images/go-16.png deleted file mode 100644 index f2bd574c65cf83062c1548ccd434105a23264bce..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 759 zcmV-hA(m;6LfOb=b2z;El94)rVBw5G`8`&q?2t z^61RcO6=LWm#Ommq+Gf7y!(96=ZW%^6IG2uHwc*dag?F9hC#|H(ri2xy>aYee}#kV zFHQ^uH+UoYJO@RkC^D=r_V+9TLTwR^ZUb`(DR$||V2_34tnJE^<5ze1ntNs0vHB`1 zm$|7rK{`j_ch~L|{-F zcl!k!{BiL$20z?IzF1erkBR&`zJ!=1hqn4F)s`)oO_R0aFJIq642jZv$&nWNC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%E{p{9sjrac4+0E@eUELgTJTVq#)qtA?NeuOxzG9 zjgazH`Se5SYx_Rqv?La2y~$)UbI!eY?!9ve4%tfI$tH*YkwYrEh5FZ1^My93$v7c{>bq`BpL zbo0w4`rww6)*cb4DDc#2x6(eJhptR@(CqwGnvM0-_;_Hb;L8n_~svZ2nw9JPIXiYpxc zWBI&^(a99rTSWA9+2M9q=JEO_mk=s|JWtT?cR^DDS1l=~D>H%!ms_+%Dn%xQpz)}P z#ySzAl~l}bYTP$Yom0bl#*;VG y*xKTwhUw#~S7=E9 diff --git a/jasmine/images/spinner.gif b/jasmine/images/spinner.gif deleted file mode 100755 index 148005da279b97c0acc697d48a815645977dc723..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1737 zcmYk+ZA?>H8o=>msePlC7H(UlOeuva6-udX=eG2X-nQJ9g5||K3}WrHKr7Zx(JnHq zYm9Sl?~UuSa${USIL0u>7~?RkfNPD*`ob8-IL0xKV;t8tt}(_n#yG|p*O+y6r*3#Y zo}4H7<@}T5Z^5mNF)7XZ9@^9BHL{rdI2d-q18QMcRe^ZC;0^r1tCZr{Fr`0(NC z>T0c4YcLp46m_{=$z<~M>C@%q<(W+8@#Du&o;;bKpWn4>S4T%jBoaAu=FHWrS8X<% zOePx}8#{LFSU4Qswr$(Jd-rIX7KucIgM$YS97rS*Cr_Tlaah-n{wj*|S@>Zf)JV^~8x2Gcz-7ZEam$UA?`%eSLi% zkH_I~T)1#yWMsr>G(LLtsJ6Ct_wL<2Jv};|PN`H*OiYAAq2l7=ojZ393=Ejf=8G3E zUcP+!!Gi~U=R0Kh!QmGv~cD#M_U#IdvW!_9YHXI*NeZFCMP!&tY zMpHwv0sV$_VhB|Jn+*hSFIK)O3^fz0y;w)HQEw<%^7csgZvS0G!2RP60Ld&xDXLb~ z(-g0~x>gTSn}re-e(+&k1GE^ND9Pd!D`^x#_JM-Jk}=?HazeIHGHr4Z{<1uku9sN;jT0*bq@ZR zy5l(W&#&;^(fMKyE012XSU8p!+6zAE5w2aQpn;?GDKjD1idkWAsSnflj1#qo+1HjNgl{r4E%i_$QP7s;6!vR z8hE*_oFdUOVKPNoBkKn{rBZL#Mj?+>4}=`_V10)I_KOn?5P!A~>PlR>U^)qn0Yi?^ z*F&Y*l%qb9`>$rBac>T_kw``2EM;^4K>9zbzzB=QfHX)^%I(#9J(%6yaGS>Yip)z@ z@t=GD;?C;|7VF0Ix+bks9I8zDY0xO=)+}GYHW><1SXCgUz@46TMePof&={?B;?p)e zZ0y!DARsJ&K^;FQ+4u=eC2TpQ_+vPf`i>z!$UvE+FBkl*75cTVT&T7R;!&%b*|ZEJ z8={SB1GGE`n<=E3#a9zf6Po_lgbEifEnPCSq8#DnjqJt7_lc3%P+X~zG|_-xw>d61 z2TF`G%I6Ts+$IxC@S(Vj#H|iH9aNRLp}SwffcV-JbXkdlVSeGHzfRj z;-!m$?-Lu`joLa1hR}e(to^|X-e!S|k}9Hp0=22jy1OwFb-Nm9k2&54o&0Z@p)Ls| zd?p6CxPyP4Ig3ZQP&&S_ss^g$zU%9$HNRND; z4%e^AlsXu!YD1y$%HE%U`TFj}`^22Zx}EvN7H5;)Wmg+$U?Y5d7Ur>bswq_3ATPx0w-9QSx`*AL7f4I3iUbdbvlHZ_8bb`@^p|+G4|{ zQXHj8)Py5_KA)4)&^Dymj*!?g{WyWSOt7jpG!FPOA8f6zn?k&eurN$ap}~GAtUohu zt2hbPuhCBVdL=MkxMfPB!yv1*XEQC6^A^BR$FQ-}iDRisxq_-wwI|zFMYzh?xSzLj Wc_{4u<=a1<$G!l-{_f-Z-~1P&zb^m) diff --git a/jasmine/lib/TrivialReporter.js b/jasmine/lib/TrivialReporter.js deleted file mode 100644 index 5b26409..0000000 --- a/jasmine/lib/TrivialReporter.js +++ /dev/null @@ -1,125 +0,0 @@ -jasmine.TrivialReporter = function(doc) { - this.document = doc || document; - this.suiteDivs = {}; -}; - -jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) { - var el = document.createElement(type); - - for (var i = 2; i < arguments.length; i++) { - var child = arguments[i]; - - if (typeof child === 'string') { - el.appendChild(document.createTextNode(child)); - } else { - el.appendChild(child); - } - } - - for (var attr in attrs) { - if (attr == 'className') { - el.setAttribute('class', attrs[attr]); - } else { - el[attr] = attrs[attr]; - } - } - - return el; -}; - -jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) { - var suites = runner.suites(); - - this.runnerDiv = this.createDom('div', { className: 'runner running' }, - this.createDom('a', { className: 'runSpec', href: '?' }, "run all"), - this.runnerMessageSpan = this.createDom('span', {}, "Running...")); - this.document.body.appendChild(this.runnerDiv); - - for (var i = 0; i < suites.length; i++) { - var suite = suites[i]; - var suiteDiv = this.createDom('div', { className: 'suite' }, - this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"), - suite.description); - this.suiteDivs[suite.getFullName()] = suiteDiv; - var parentDiv = this.document.body; - if (suite.parentSuite) { - parentDiv = this.suiteDivs[suite.parentSuite.getFullName()]; - } - parentDiv.appendChild(suiteDiv); - } - - this.startedAt = new Date(); -}; - -jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) { - var results = runner.getResults(); - var className = (results.failedCount > 0) ? "runner failed" : "runner passed"; - this.runnerDiv.setAttribute("class", className); - var message = results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s"); - message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"; - this.runnerMessageSpan.replaceChild(this.document.createTextNode(message), this.runnerMessageSpan.firstChild); -}; - -jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) { - var results = suite.getResults(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.totalCount == 0) { // todo: change this to check results.skipped - status = 'skipped'; - } - this.suiteDivs[suite.getFullName()].className += " " + status; -}; - -jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) { - var results = spec.getResults(); - var status = results.passed() ? 'passed' : 'failed'; - if (results.skipped) { - status = 'skipped'; - } - var specDiv = this.createDom('div', { className: 'spec ' + status }, - this.createDom('a', { className: 'runSpec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"), - spec.getFullName()); - - - var resultItems = results.getItems(); - for (var i = 0; i < resultItems.length; i++) { - var result = resultItems[i]; - if (result.passed && !result.passed()) { - var resultMessageDiv = this.createDom('div', {className: 'resultMessage fail'}); - resultMessageDiv.innerHTML = result.message; // todo: lame; mend - specDiv.appendChild(resultMessageDiv); - specDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack)); - } - } - - this.suiteDivs[spec.suite.getFullName()].appendChild(specDiv); -}; - -jasmine.TrivialReporter.prototype.log = function() { - console.log.apply(console, arguments); -}; - -jasmine.TrivialReporter.prototype.getLocation = function() { - return this.document.location; -}; - -jasmine.TrivialReporter.prototype.specFilter = function(spec) { - var paramMap = {}; - var params = this.getLocation().search.substring(1).split('&'); - for (var i = 0; i < params.length; i++) { - var p = params[i].split('='); - paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]); - } - - if (!paramMap["spec"]) return true; - return spec.getFullName().indexOf(paramMap["spec"]) == 0; -}; - -//protect against console.log incidents -if (!("console" in window) || !("firebug" in console)) { - var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"]; - window.console = {}; - for (var i = 0, len = names.length; i < len; ++i) { - window.console[names[i]] = function() { - }; - } -} diff --git a/jasmine/lib/jasmine-0.9.0.js b/jasmine/lib/jasmine-0.9.0.js deleted file mode 100644 index 21ca905..0000000 --- a/jasmine/lib/jasmine-0.9.0.js +++ /dev/null @@ -1,2034 +0,0 @@ -/** - * Top level namespace for Jasmine, a lightweight JavaScript BDD/spec/testing framework. - * - * @namespace - */ -var jasmine = {}; - -/** - * @private - */ -jasmine.unimplementedMethod_ = function() { - throw new Error("unimplemented method"); -}; - -/** - * Allows for bound functions to be comapred. Internal use only. - * - * @ignore - * @private - * @param base {Object} bound 'this' for the function - * @param name {Function} function to find - */ -jasmine.bindOriginal_ = function(base, name) { - var original = base[name]; - return function() { - return original.apply(base, arguments); - }; -}; - -jasmine.setTimeout = jasmine.bindOriginal_(window, 'setTimeout'); -jasmine.clearTimeout = jasmine.bindOriginal_(window, 'clearTimeout'); -jasmine.setInterval = jasmine.bindOriginal_(window, 'setInterval'); -jasmine.clearInterval = jasmine.bindOriginal_(window, 'clearInterval'); - -jasmine.MessageResult = function(text) { - this.type = 'MessageResult'; - this.text = text; - this.trace = new Error(); // todo: test better -}; - -jasmine.ExpectationResult = function(passed, message, details) { - this.type = 'ExpectationResult'; - this.passed_ = passed; - this.message = message; - this.details = details; - this.trace = new Error(message); // todo: test better -}; - -jasmine.ExpectationResult.prototype.passed = function () { - return this.passed_; -}; - -/** - * Getter for the Jasmine environment. Ensures one gets created - */ -jasmine.getEnv = function() { - return jasmine.currentEnv_ = jasmine.currentEnv_ || new jasmine.Env(); -}; - -/** - * @ignore - * @private - * @param value - * @returns {Boolean} - */ -jasmine.isArray_ = function(value) { - return value && - typeof value === 'object' && - typeof value.length === 'number' && - typeof value.splice === 'function' && - !(value.propertyIsEnumerable('length')); -}; - -/** - * Pretty printer for expecations. Takes any object and turns it into a human-readable string. - * - * @param value {Object} an object to be outputted - * @returns {String} - */ -jasmine.pp = function(value) { - var stringPrettyPrinter = new jasmine.StringPrettyPrinter(); - stringPrettyPrinter.format(value); - return stringPrettyPrinter.string; -}; - -/** - * Returns true if the object is a DOM Node. - * - * @param {Object} obj object to check - * @returns {Boolean} - */ -jasmine.isDomNode = function(obj) { - return obj['nodeType'] > 0; -}; - -/** - * Returns a matchable 'generic' object of the class type. For use in expecations of type when values don't matter. - * - * @example - * // don't care about which function is passed in, as long as it's a function - * expect(mySpy).wasCalledWith(jasmine.any(Function)); - * - * @param {Class} clazz - * @returns matchable object of the type clazz - */ -jasmine.any = function(clazz) { - return new jasmine.Matchers.Any(clazz); -}; - -/** - * Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks. - * - * Spies should be created in test setup, before expectations. They can then be checked, using the standard Jasmine - * expectation syntax. Spies can be checked if they were called or not and what the calling params were. - * - * A Spy has the following mehtod: wasCalled, callCount, mostRecentCall, and argsForCall (see docs) - * Spies are torn down at the end of every spec. - * - * Note: Do not call new jasmine.Spy() directly - a spy must be created using spyOn, jasmine.createSpy or jasmine.createSpyObj. - * - * @example - * // a stub - * var myStub = jasmine.createSpy('myStub'); // can be used anywhere - * - * // spy example - * var foo = { - * not: function(bool) { return !bool; } - * } - * - * // actual foo.not will not be called, execution stops - * spyOn(foo, 'not'); - - // foo.not spied upon, execution will continue to implementation - * spyOn(foo, 'not').andCallThrough(); - * - * // fake example - * var foo = { - * not: function(bool) { return !bool; } - * } - * - * // foo.not(val) will return val - * spyOn(foo, 'not').andCallFake(function(value) {return value;}); - * - * // mock example - * foo.not(7 == 7); - * expect(foo.not).wasCalled(); - * expect(foo.not).wasCalledWith(true); - * - * @constructor - * @see spyOn, jasmine.createSpy, jasmine.createSpyObj - * @param {String} name - */ -jasmine.Spy = function(name) { - /** - * The name of the spy, if provided. - */ - this.identity = name || 'unknown'; - /** - * Is this Object a spy? - */ - this.isSpy = true; - /** - * The acutal function this spy stubs. - */ - this.plan = function() {}; - /** - * Tracking of the most recent call to the spy. - * @example - * var mySpy = jasmine.createSpy('foo'); - * mySpy(1, 2); - * mySpy.mostRecentCall.args = [1, 2]; - */ - this.mostRecentCall = {}; - - /** - * Holds arguments for each call to the spy, indexed by call count - * @example - * var mySpy = jasmine.createSpy('foo'); - * mySpy(1, 2); - * mySpy(7, 8); - * mySpy.mostRecentCall.args = [7, 8]; - * mySpy.argsForCall[0] = [1, 2]; - * mySpy.argsForCall[1] = [7, 8]; - */ - this.argsForCall = []; -}; - -/** - * Tells a spy to call through to the actual implemenatation. - * - * @example - * var foo = { - * bar: function() { // do some stuff } - * } - * - * // defining a spy on an existing property: foo.bar - * spyOn(foo, 'bar').andCallThrough(); - */ -jasmine.Spy.prototype.andCallThrough = function() { - this.plan = this.originalValue; - return this; -}; - -/** - * For setting the return value of a spy. - * - * @example - * // defining a spy from scratch: foo() returns 'baz' - * var foo = jasmine.createSpy('spy on foo').andReturn('baz'); - * - * // defining a spy on an existing property: foo.bar() returns 'baz' - * spyOn(foo, 'bar').andReturn('baz'); - * - * @param {Object} value - */ -jasmine.Spy.prototype.andReturn = function(value) { - this.plan = function() { - return value; - }; - return this; -}; - -/** - * For throwing an exception when a spy is called. - * - * @example - * // defining a spy from scratch: foo() throws an exception w/ message 'ouch' - * var foo = jasmine.createSpy('spy on foo').andThrow('baz'); - * - * // defining a spy on an existing property: foo.bar() throws an exception w/ message 'ouch' - * spyOn(foo, 'bar').andThrow('baz'); - * - * @param {String} exceptionMsg - */ -jasmine.Spy.prototype.andThrow = function(exceptionMsg) { - this.plan = function() { - throw exceptionMsg; - }; - return this; -}; - -/** - * Calls an alternate implementation when a spy is called. - * - * @example - * var baz = function() { - * // do some stuff, return something - * } - * // defining a spy from scratch: foo() calls the function baz - * var foo = jasmine.createSpy('spy on foo').andCall(baz); - * - * // defining a spy on an existing property: foo.bar() calls an anonymnous function - * spyOn(foo, 'bar').andCall(function() { return 'baz';} ); - * - * @param {Function} fakeFunc - */ -jasmine.Spy.prototype.andCallFake = function(fakeFunc) { - this.plan = fakeFunc; - return this; -}; - -/** - * Resets all of a spy's the tracking variables so that it can be used again. - * - * @example - * spyOn(foo, 'bar'); - * - * foo.bar(); - * - * expect(foo.bar.callCount).toEqual(1); - * - * foo.bar.reset(); - * - * expect(foo.bar.callCount).toEqual(0); - */ -jasmine.Spy.prototype.reset = function() { - this.wasCalled = false; - this.callCount = 0; - this.argsForCall = []; - this.mostRecentCall = {}; -}; - -jasmine.createSpy = function(name) { - - var spyObj = function() { - spyObj.wasCalled = true; - spyObj.callCount++; - var args = jasmine.util.argsToArray(arguments); - //spyObj.mostRecentCall = { - // object: this, - // args: args - //}; - spyObj.mostRecentCall.object = this; - spyObj.mostRecentCall.args = args; - spyObj.argsForCall.push(args); - return spyObj.plan.apply(this, arguments); - }; - - var spy = new jasmine.Spy(name); - - for(var prop in spy) { - spyObj[prop] = spy[prop]; - } - - spyObj.reset(); - - return spyObj; -}; - -/** - * Creates a more complicated spy: an Object that has every property a function that is a spy. Used for stubbing something - * large in one call. - * - * @param {String} baseName name of spy class - * @param {Array} methodNames array of names of methods to make spies - */ -jasmine.createSpyObj = function(baseName, methodNames) { - var obj = {}; - for (var i = 0; i < methodNames.length; i++) { - obj[methodNames[i]] = jasmine.createSpy(baseName + '.' + methodNames[i]); - } - return obj; -}; - -jasmine.log = function(message) { - jasmine.getEnv().currentSpec.getResults().log(message); -}; - -/** - * Function that installs a spy on an existing object's method name. Used within a Spec to create a spy. - * - * @example - * // spy example - * var foo = { - * not: function(bool) { return !bool; } - * } - * spyOn(foo, 'not'); // actual foo.not will not be called, execution stops - * - * @see jasmine.createSpy - * @param obj - * @param methodName - * @returns a Jasmine spy that can be chained with all spy methods - */ -var spyOn = function(obj, methodName) { - return jasmine.getEnv().currentSpec.spyOn(obj, methodName); -}; - -/** - * Creates a Jasmine spec that will be added to the current suite. - * - * // TODO: pending tests - * - * @example - * it('should be true', function() { - * expect(true).toEqual(true); - * }); - * - * @param {String} desc description of this specification - * @param {Function} func defines the preconditions and expectations of the spec - */ -var it = function(desc, func) { - return jasmine.getEnv().it(desc, func); -}; - -/** - * Creates a disabled Jasmine spec. - * - * A convenience method that allows existing specs to be disabled temporarily during development. - * - * @param {String} desc description of this specification - * @param {Function} func defines the preconditions and expectations of the spec - */ -var xit = function(desc, func) { - return jasmine.getEnv().xit(desc, func); -}; - -/** - * Starts a chain for a Jasmine expectation. - * - * It is passed an Object that is the actual value and should chain to one of the many - * jasmine.Matchers functions. - * - * @param {Object} actual Actual value to test against and expected value - */ -var expect = function(actual) { - return jasmine.getEnv().currentSpec.expect(actual); -}; - -/** - * Defines part of a jasmine spec. Used in cominbination with waits or waitsFor in asynchrnous specs. - * - * @param {Function} func Function that defines part of a jasmine spec. - */ -var runs = function(func) { - jasmine.getEnv().currentSpec.runs(func); -}; - -/** - * Waits for a timeout before moving to the next runs()-defined block. - * @param {Number} timeout - */ -var waits = function(timeout) { - jasmine.getEnv().currentSpec.waits(timeout); -}; - -/** - * Waits for the latchFunction to return true before proceeding to the next runs()-defined block. - * - * @param {Number} timeout - * @param {Function} latchFunction - * @param {String} message - */ -var waitsFor = function(timeout, latchFunction, message) { - jasmine.getEnv().currentSpec.waitsFor(timeout, latchFunction, message); -}; - -/** - * A function that is called before each spec in a suite. - * - * Used for spec setup, including validating assumptions. - * - * @param {Function} beforeEachFunction - */ -var beforeEach = function(beforeEachFunction) { - jasmine.getEnv().beforeEach(beforeEachFunction); -}; - -/** - * A function that is called after each spec in a suite. - * - * Used for restoring any state that is hijacked during spec execution. - * - * @param {Function} afterEachFunction - */ -var afterEach = function(afterEachFunction) { - jasmine.getEnv().afterEach(afterEachFunction); -}; - -/** - * Defines a suite of specifications. - * - * Stores the description and all defined specs in the Jasmine environment as one suite of specs. Variables declared - * are accessible by calls to beforeEach, it, and afterEach. Describe blocks can be nested, allowing for specialization - * of setup in some tests. - * - * @example - * // TODO: a simple suite - * - * // TODO: a simple suite with a nested describe block - * - * @param {String} description A string, usually the class under test. - * @param {Function} specDefinitions function that defines several specs. - */ -var describe = function(description, specDefinitions) { - return jasmine.getEnv().describe(description, specDefinitions); -}; - -/** - * Disables a suite of specifications. Used to disable some suites in a file, or files, temporarily during development. - * - * @param {String} description A string, usually the class under test. - * @param {Function} specDefinitions function that defines several specs. - */ -var xdescribe = function(description, specDefinitions) { - return jasmine.getEnv().xdescribe(description, specDefinitions); -}; - - -jasmine.XmlHttpRequest = XMLHttpRequest; - -// Provide the XMLHttpRequest class for IE 5.x-6.x: -if (typeof XMLHttpRequest == "undefined") jasmine.XmlHttpRequest = function() { - try { - return new ActiveXObject("Msxml2.XMLHTTP.6.0"); - } catch(e) { - } - try { - return new ActiveXObject("Msxml2.XMLHTTP.3.0"); - } catch(e) { - } - try { - return new ActiveXObject("Msxml2.XMLHTTP"); - } catch(e) { - } - try { - return new ActiveXObject("Microsoft.XMLHTTP"); - } catch(e) { - } - throw new Error("This browser does not support XMLHttpRequest."); -}; - -/** - * Adds suite files to an HTML document so that they are executed, thus adding them to the current - * Jasmine environment. - * - * @param {String} url path to the file to include - * @param {Boolean} opt_global - */ -jasmine.include = function(url, opt_global) { - if (opt_global) { - document.write('