diff --git a/README.markdown b/README.markdown index 6a2466e..3b45bbb 100644 --- a/README.markdown +++ b/README.markdown @@ -31,9 +31,11 @@ open `examples/test/html/example_suite.html` in your favorite browser. Releases ---------- -0.9.0 beta [[download]](http://github.com/pivotal/jasmine/zipball/master) +0.10.0 [[download]](http://github.com/pivotal/jasmine/zipball/master) `git clone git://github.com/pivotal/jasmine.git` +0.9.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.9.0) + 0.8.0 [[download]](http://github.com/pivotal/jasmine/zipball/0.8.0) ### Which Release Should I Use? @@ -261,11 +263,11 @@ A suite can have a beforeEach declaration. It takes a function that is run befor beforeEach(function () { suiteWideFoo = 1; - } + }); it('should equal bar', function () { expect(suiteWideFoo).toEqual(1); - }; + }); }); A runner can also have beforeEach declarations. Runner beforeEach functions are executed before every spec in all suites, and execute BEFORE suite beforeEach functions. For example: @@ -280,11 +282,11 @@ A runner can also have beforeEach declarations. Runner beforeEach functions are beforeEach(function () { runnerWideFoo.push('suite'); - } + }); it('should equal bar', function () { expect(runnerWideFoo).toEqual(['runner', 'suite']); - }; + }); }); #### afterEach @@ -296,11 +298,11 @@ Similarly, there is an afterEach declaration. It takes a function that is run a 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); @@ -319,11 +321,11 @@ A runner can also have an afterEach declarations. Runner afterEach functions are afterEach(function () { runnerWideFoo.push('suite'); - } + }); it('should be empty', function () { expect(runnerWideFoo).toEqual([]); - }; + }); it('should be populated after', function () { expect(runnerWideFoo).toEqual(['suite', 'runner']); @@ -350,14 +352,14 @@ Jasmine supports nested describes. An example: 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 @@ -367,15 +369,15 @@ Jasmine integrates 'spies' that permit many spying, mocking, and faking behavior 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'); - } + }; ... diff --git a/contrib/ruby/jasmine_runner.rb b/contrib/ruby/jasmine_runner.rb index 44f3026..6d27b6b 100644 --- a/contrib/ruby/jasmine_runner.rb +++ b/contrib/ruby/jasmine_runner.rb @@ -61,13 +61,14 @@ module Jasmine end class RunAdapter - def initialize(spec_files_or_proc, jasmine_files = nil) + def initialize(spec_files_or_proc, jasmine_files = nil, stylesheets = []) @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" ] + @stylesheets = ["/__JASMINE_ROOT__/lib/jasmine.css"] + stylesheets end def call(env) @@ -77,7 +78,7 @@ module Jasmine jasmine_files = @jasmine_files jasmine_files = jasmine_files.call if jasmine_files.respond_to?(:call) - css_files = ["/__JASMINE_ROOT__/lib/jasmine.css"] + css_files = @stylesheets body = ERB.new(File.read(File.join(File.dirname(__FILE__), "run.html"))).result(binding) [ @@ -113,12 +114,12 @@ module Jasmine end class SimpleServer - def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil) + def self.start(port, spec_files_or_proc, mappings, jasmine_files = nil, stylesheets = []) require 'thin' config = { '/run.html' => Jasmine::Redirect.new('/'), - '/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files) + '/' => Jasmine::RunAdapter.new(spec_files_or_proc, jasmine_files, stylesheets) } mappings.each do |from, to| config[from] = Rack::File.new(to) @@ -185,6 +186,8 @@ module Jasmine @dir_mappings = dir_mappings @jasmine_files = jasmine_files @browser = options[:browser] || 'firefox' + @stylesheets = options[:stylesheets] || [] + @selenium_pid = nil @jasmine_server_pid = nil @@ -213,7 +216,7 @@ module Jasmine @jasmine_server_pid = fork do Process.setpgrp - Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files) + Jasmine::SimpleServer.start(@jasmine_server_port, @spec_files, @dir_mappings, @jasmine_files, @stylesheets) exit! 0 end puts "jasmine server started. pid is #{@jasmine_server_pid}" diff --git a/contrib/ruby/run.html b/contrib/ruby/run.html index ec6e89f..676d75c 100644 --- a/contrib/ruby/run.html +++ b/contrib/ruby/run.html @@ -4,7 +4,7 @@