From fe03ea0d1f8814817bee5a35d745db16858eb490 Mon Sep 17 00:00:00 2001
From: Andres Ornelas
Date: Wed, 9 Jun 2010 12:35:40 -0700
Subject: add repeater DSL and fix typo
---
test/scenario/DSLSpec.js | 14 +++++++++++++-
test/scenario/RunnerSpec.js | 2 +-
2 files changed, 14 insertions(+), 2 deletions(-)
(limited to 'test')
diff --git a/test/scenario/DSLSpec.js b/test/scenario/DSLSpec.js
index bed1f008..0cce7b75 100644
--- a/test/scenario/DSLSpec.js
+++ b/test/scenario/DSLSpec.js
@@ -40,4 +40,16 @@ describe("DSL", function() {
expect(lastDocument.find(':radio:checked').val()).toEqual('female');
});
});
-});
\ No newline at end of file
+
+ describe('expect', function() {
+ var dslExpect = angular.scenario.dsl.expect;
+ describe('repeater', function() {
+ it('should check the count of repeated elements', function() {
+ dslExpect.repeater('.repeater-row').count.toEqual(2);
+ expect(lastStep.name).toEqual("Expect to see 2 items repeated with selector '.repeater-row'");
+ var html = "
a
b
";
+ executeStep(lastStep, html);
+ });
+ });
+ });
+});
diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js
index 35d74f51..030bdc06 100644
--- a/test/scenario/RunnerSpec.js
+++ b/test/scenario/RunnerSpec.js
@@ -36,7 +36,7 @@ describe('Runner', function(){
expect(spec.name).toEqual('describe name: it should text');
});
- it('should camplain on duplicate it', angular.noop);
+ it('should complain on duplicate it', angular.noop);
it('should create a failing step if there is a javascript error', function(){
var spec;
Describe('D1', function(){
--
cgit v1.2.3
From f6a405c283ba1f2e0037e0bedb52e5cee618d4ff Mon Sep 17 00:00:00 2001
From: Andres Ornelas
Date: Wed, 9 Jun 2010 13:30:54 -0700
Subject: change repeater count expectation wording
---
test/scenario/DSLSpec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'test')
diff --git a/test/scenario/DSLSpec.js b/test/scenario/DSLSpec.js
index 0cce7b75..5aac9752 100644
--- a/test/scenario/DSLSpec.js
+++ b/test/scenario/DSLSpec.js
@@ -46,7 +46,7 @@ describe("DSL", function() {
describe('repeater', function() {
it('should check the count of repeated elements', function() {
dslExpect.repeater('.repeater-row').count.toEqual(2);
- expect(lastStep.name).toEqual("Expect to see 2 items repeated with selector '.repeater-row'");
+ expect(lastStep.name).toEqual("Expect that there are 2 items in Repeater with selector '.repeater-row'");
var html = "a
b
";
executeStep(lastStep, html);
});
--
cgit v1.2.3
From 85fac4d78c131771d7fdd46d6ccd44bae92419cd Mon Sep 17 00:00:00 2001
From: Andres Ornelas
Date: Wed, 9 Jun 2010 14:12:54 -0700
Subject: add beforeEach and afterEach to scenario DSL
---
test/scenario/RunnerSpec.js | 40 +++++++++++++++++++++++++++++++++++++++-
1 file changed, 39 insertions(+), 1 deletion(-)
(limited to 'test')
diff --git a/test/scenario/RunnerSpec.js b/test/scenario/RunnerSpec.js
index 030bdc06..ca6e8eb2 100644
--- a/test/scenario/RunnerSpec.js
+++ b/test/scenario/RunnerSpec.js
@@ -14,6 +14,8 @@ describe('Runner', function(){
body = _jQuery('');
runner = new angular.scenario.Runner(scenario, _jQuery);
Describe = scenario.describe;
+ BeforeEach = scenario.beforeEach;
+ AfterEach = scenario.afterEach;
It = scenario.it;
$scenario = scenario.$scenario;
});
@@ -36,7 +38,10 @@ describe('Runner', function(){
expect(spec.name).toEqual('describe name: it should text');
});
- it('should complain on duplicate it', angular.noop);
+ it('should complain on duplicate it', function() {
+ // WRITE ME!!!!
+ });
+
it('should create a failing step if there is a javascript error', function(){
var spec;
Describe('D1', function(){
@@ -55,6 +60,39 @@ describe('Runner', function(){
};
});
});
+
+ describe('beforeEach', function() {
+ it('should execute beforeEach before every it', function() {
+ Describe('describe name', function(){
+ BeforeEach(logger('before;'));
+ It('should text', logger('body;'));
+ It('should text2', logger('body2;'));
+ });
+ expect(log).toEqual('before;body;before;body2;');
+ });
+ });
+ describe('afterEach', function() {
+ it('should execute afterEach after every it', function() {
+ Describe('describe name', function(){
+ AfterEach(logger('after;'));
+ It('should text', logger('body;'));
+ It('should text2', logger('body2;'));
+ });
+ expect(log).toEqual('body;after;body2;after;');
+ });
+
+ it('should always execute afterEach after every it', function() {
+ Describe('describe name', function(){
+ AfterEach(logger('after;'));
+ It('should text', function() {
+ log = 'body;';
+ throw "MyError";
+ });
+ It('should text2', logger('body2;'));
+ });
+ expect(log).toEqual('body;after;body2;after;');
+ });
+ });
});
describe('steps building', function(){
--
cgit v1.2.3