Skip to content

Commit 6c085ad

Browse files
author
davert
committed
only specifications can be passed
1 parent f31a9b8 commit 6c085ad

3 files changed

Lines changed: 28 additions & 23 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.2
1+
0.3.3

src/Codeception/Specify.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ trait Specify {
77
protected $__beforeSpecify;
88
protected $__afterSpecify;
99

10-
function specify($specification, \Closure $callable, $params = [])
10+
function specify($specification, \Closure $callable = null, $params = [])
1111
{
12+
if (!$callable) return;
1213
// config
1314
$test = $callable->bindTo($this);
1415
$name = $this->getName();

tests/SpecifyTest.php

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ function testBeforeCallback()
3434
});
3535
}
3636

37-
// function testAfterCallback()
38-
// {
39-
// $this->afterSpecify(function() {
40-
// $this->user = "davert";
41-
// });
42-
// $this->specify("user should be davert", function() {
43-
// $this->user = "jon";
44-
// });
45-
// $this->assertEquals('davert', $this->user);
46-
// }
37+
function testAfterCallback()
38+
{
39+
$this->afterSpecify(function() {
40+
$this->user = "davert";
41+
});
42+
$this->specify("user should be davert", function() {
43+
$this->user = "jon";
44+
});
45+
$this->assertEquals('davert', $this->user);
46+
}
4747

48-
// function testCleanSpecifyCallbacks()
49-
// {
50-
// $this->afterSpecify(function() {
51-
// $this->user = "davert";
52-
// });
53-
// $this->cleanSpecify();
54-
// $this->specify("user should be davert", function() {
55-
// $this->user = "jon";
56-
// });
57-
// $this->assertNull($this->user);
58-
// }
48+
function testCleanSpecifyCallbacks()
49+
{
50+
$this->afterSpecify(function() {
51+
$this->user = "davert";
52+
});
53+
$this->cleanSpecify();
54+
$this->specify("user should be davert", function() {
55+
$this->user = "jon";
56+
});
57+
$this->assertNull($this->user);
58+
}
5959

6060
public function testExceptions()
6161
{
@@ -86,5 +86,9 @@ public function testExamples()
8686
]]);
8787
}
8888

89+
function testOnlySpecifications()
90+
{
91+
$this->specify('should be valid');
92+
}
8993

9094
}

0 commit comments

Comments
 (0)