Merge branch 'master' into dot-not
This commit is contained in:
@@ -1,11 +1,20 @@
|
||||
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.specs,
|
||||
JasmineHelper.dir_mappings)
|
||||
jasmine_runner = if ENV['SAUCELABS'] == 'true'
|
||||
require 'sauce_tunnel'
|
||||
require 'selenium_config'
|
||||
Jasmine::SauceLabsRunner.new(JasmineHelper.specs,
|
||||
JasmineHelper.dir_mappings,
|
||||
:saucelabs_config => 'saucelabs',
|
||||
:saucelabs_config_file => File.expand_path(File.join(File.dirname(__FILE__), "saucelabs.yml")))
|
||||
else
|
||||
require "selenium_rc"
|
||||
Jasmine::Runner.new(SeleniumRC::Server.new('localhost').jar_path,
|
||||
JasmineHelper.specs,
|
||||
JasmineHelper.dir_mappings)
|
||||
end
|
||||
|
||||
spec_builder = Jasmine::SpecBuilder.new(JasmineHelper.raw_spec_files, jasmine_runner)
|
||||
|
||||
|
||||
24
spec/saucelabs.yml
Normal file
24
spec/saucelabs.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
local:
|
||||
application_framework: :selenium
|
||||
#
|
||||
# Possible Sauce Labs configurations as of 2009/11/19
|
||||
# From: http://saucelabs.com/products/docs/sauce-ondemand/browsers
|
||||
# os: "Windows 2003"
|
||||
# browser: "iexplore"
|
||||
# browser-version: "6.", "7.", "8."
|
||||
# browser: "firefox"
|
||||
# browser-version: "2.", "3.0", "3.5"
|
||||
# browser: "safari"
|
||||
# browser-version: "3.", "4."
|
||||
# browser: "opera"
|
||||
# browser-version: "9."
|
||||
# browser: "googlechrome"
|
||||
# browser-version: ""
|
||||
# os: "Linux"
|
||||
# browser: "firefox"
|
||||
# browser-version: "3."
|
||||
saucelabs:
|
||||
application_framework: :external
|
||||
selenium_server_address: "saucelabs.com"
|
||||
selenium_browser_key: '{"username": "--YOUR-SAUCELABS-USERNAME--", "access-key": "--YOUR-SAUCELABS-ACCESS-KEY--", "os": "Linux", "browser": "firefox", "browser-version": "3."}'
|
||||
application_port: "80"
|
||||
@@ -6,14 +6,13 @@ describe("jasmine.Env", function() {
|
||||
});
|
||||
|
||||
describe('ids', function () {
|
||||
|
||||
it('nextSpecId should return consecutive integers, starting at 0', function () {
|
||||
expect(env.nextSpecId()).toEqual(0);
|
||||
expect(env.nextSpecId()).toEqual(1);
|
||||
expect(env.nextSpecId()).toEqual(2);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe("reporting", function() {
|
||||
var fakeReporter;
|
||||
|
||||
@@ -42,7 +41,6 @@ describe("jasmine.Env", function() {
|
||||
exception = e;
|
||||
}
|
||||
expect(exception.message).toEqual('Version not set');
|
||||
|
||||
});
|
||||
|
||||
it("version should return the current version as an int", function() {
|
||||
@@ -58,7 +56,6 @@ describe("jasmine.Env", function() {
|
||||
"build": 7,
|
||||
"revision": 8
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -589,6 +589,18 @@ describe("jasmine.Matchers", function() {
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.expected).toEqual(['c', 'b', 'a']);
|
||||
expect(result.actual.mostRecentCall.args).toEqual(['a', 'b', 'c']);
|
||||
expect(result.message).toContain(jasmine.pp(result.expected));
|
||||
expect(result.message).toContain(jasmine.pp(result.actual.mostRecentCall.args));
|
||||
});
|
||||
|
||||
it('should return false if it was not called', function() {
|
||||
var expected = match(TestClass.spyFunction);
|
||||
expect(expected.wasCalledWith('c', 'b', 'a')).toEqual(false);
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.expected).toEqual(['c', 'b', 'a']);
|
||||
expect(result.actual.argsForCall).toEqual([]);
|
||||
expect(result.message).toContain(jasmine.pp(result.expected));
|
||||
});
|
||||
|
||||
it('should allow matches across multiple calls', function() {
|
||||
@@ -622,12 +634,48 @@ describe("jasmine.Matchers", function() {
|
||||
var result = lastResult();
|
||||
expect(result.matcherName).toEqual("wasCalledWith");
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.message).toMatch("['a', 'b']");
|
||||
expect(result.message).toMatch("['a', 'c']");
|
||||
expect(result.message).toContain(jasmine.pp(['a', 'b']));
|
||||
expect(result.message).toContain(jasmine.pp(['a', 'c']));
|
||||
expect(result.actual).toEqual(TestClass.someFunction);
|
||||
expect(result.expected).toEqual(['a','b']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("wasNotCalledWith", function() {
|
||||
it('should return true if the spy was NOT called with the expected args', function() {
|
||||
TestClass.spyFunction('a', 'b', 'c');
|
||||
expect(match(TestClass.spyFunction).wasNotCalledWith('c', 'b', 'a')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should return false if it WAS called with the expected args', function() {
|
||||
TestClass.spyFunction('a', 'b', 'c');
|
||||
var expected = match(TestClass.spyFunction);
|
||||
expect(expected.wasNotCalledWith('a', 'b', 'c')).toEqual(false);
|
||||
var result = mockSpec.addMatcherResult.mostRecentCall.args[0];
|
||||
expect(result.passed()).toEqual(false);
|
||||
expect(result.expected).toEqual(['a', 'b', 'c']);
|
||||
expect(result.actual.mostRecentCall.args).toEqual(['a', 'b', 'c']);
|
||||
expect(result.message).toContain(jasmine.pp(result.expected));
|
||||
});
|
||||
|
||||
it('should return true if it was not called', function() {
|
||||
var expected = match(TestClass.spyFunction);
|
||||
expect(expected.wasNotCalledWith('c', 'b', 'a')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should allow matches across multiple calls', function() {
|
||||
var expected = match(TestClass.spyFunction);
|
||||
TestClass.spyFunction('a', 'b', 'c');
|
||||
TestClass.spyFunction('d', 'e', 'f');
|
||||
expect(expected.wasNotCalledWith('a', 'b', 'c')).toEqual(false);
|
||||
expect(expected.wasNotCalledWith('d', 'e', 'f')).toEqual(false);
|
||||
expect(expected.wasNotCalledWith('x', 'y', 'z')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should throw an exception when invoked on a non-spy', shouldThrowAnExceptionWhenInvokedOnANonSpy('wasNotCalledWith'));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -217,8 +217,6 @@ describe('RunnerTest', function() {
|
||||
expect(fakeReporter.reportRunnerResults).wasCalled();
|
||||
expect(fakeReporter.reportRunnerResults.mostRecentCall.args[0].results()).toEqual(env.currentRunner().results());
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
it("should report when the tests start running", function() {
|
||||
@@ -235,7 +233,6 @@ describe('RunnerTest', function() {
|
||||
var reportedRunner = fakeReporter.reportRunnerStarting.mostRecentCall.args[0];
|
||||
expect(reportedRunner.arbitraryVariable).toEqual('foo');
|
||||
expect(runner.queue.start).wasCalled();
|
||||
|
||||
});
|
||||
|
||||
it("should return a flat array of all suites, including nested suites", function() {
|
||||
@@ -245,8 +242,6 @@ describe('RunnerTest', function() {
|
||||
});
|
||||
});
|
||||
|
||||
document.runner = env.currentRunner();
|
||||
|
||||
var suites = env.currentRunner().suites();
|
||||
var suiteDescriptions = [];
|
||||
for (var i = 0; i < suites.length; i++) {
|
||||
@@ -254,5 +249,4 @@ describe('RunnerTest', function() {
|
||||
}
|
||||
expect(suiteDescriptions).toEqual([suite1.getFullName(), suite2.getFullName()]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -33,8 +33,8 @@ describe('Spies', function () {
|
||||
|
||||
TestClass.someFunction('foo');
|
||||
TestClass.someFunction('bar');
|
||||
expect(TestClass.someFunction.argsForCall[0]).toEqual(['foo']);
|
||||
expect(TestClass.someFunction.argsForCall[1]).toEqual(['bar']);
|
||||
expect(TestClass.someFunction.calls[0].args).toEqual(['foo']);
|
||||
expect(TestClass.someFunction.calls[1].args).toEqual(['bar']);
|
||||
expect(TestClass.someFunction.mostRecentCall.args).toEqual(['bar']);
|
||||
});
|
||||
|
||||
@@ -177,11 +177,25 @@ describe('Spies', function () {
|
||||
expect(TestClass.someFunction.callCount).toEqual(0);
|
||||
});
|
||||
|
||||
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
|
||||
var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']);
|
||||
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
||||
expect(spyObj.method1.identity).toEqual('BaseName.method1');
|
||||
expect(spyObj.method2.identity).toEqual('BaseName.method2');
|
||||
describe("createSpyObj", function() {
|
||||
it("should create an object with a bunch of spy methods when you call jasmine.createSpyObj()", function() {
|
||||
var spyObj = jasmine.createSpyObj('BaseName', ['method1', 'method2']);
|
||||
expect(spyObj).toEqual({ method1: jasmine.any(Function), method2: jasmine.any(Function)});
|
||||
expect(spyObj.method1.identity).toEqual('BaseName.method1');
|
||||
expect(spyObj.method2.identity).toEqual('BaseName.method2');
|
||||
});
|
||||
|
||||
it("should throw if you do not pass an array argument", function() {
|
||||
expect(function() {
|
||||
jasmine.createSpyObj('BaseName');
|
||||
}).toThrow('createSpyObj requires a non-empty array of method names to create spies for');
|
||||
});
|
||||
|
||||
it("should throw if you pass an empty array argument", function() {
|
||||
expect(function() {
|
||||
jasmine.createSpyObj('BaseName');
|
||||
}).toThrow('createSpyObj requires a non-empty array of method names to create spies for');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,4 +20,21 @@ describe("jasmine.util", function() {
|
||||
expect(destination).toEqual({foo: null});
|
||||
});
|
||||
});
|
||||
|
||||
describe("isArray_", function() {
|
||||
it("should return true if the argument is an array", function() {
|
||||
expect(jasmine.isArray_([])).toBe(true);
|
||||
expect(jasmine.isArray_(['a'])).toBe(true);
|
||||
expect(jasmine.isArray_(new Array())).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false if the argument is not an array", function() {
|
||||
expect(jasmine.isArray_(undefined)).toBe(false);
|
||||
expect(jasmine.isArray_({})).toBe(false);
|
||||
expect(jasmine.isArray_(function() {})).toBe(false);
|
||||
expect(jasmine.isArray_('foo')).toBe(false);
|
||||
expect(jasmine.isArray_(5)).toBe(false);
|
||||
expect(jasmine.isArray_(null)).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user