expectations 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ module Expectations::BehaviorBasedExpectation
|
|
5
5
|
begin
|
6
6
|
mocha_setup
|
7
7
|
instance_exec expected.mock, &block
|
8
|
-
|
8
|
+
expected.verify
|
9
9
|
self.extend(Expectations::Results::Fulfilled)
|
10
10
|
rescue Mocha::ExpectationError => ex
|
11
11
|
self.extend(Expectations::Results::BehaviorFailure)
|
data/lib/expectations/suite.rb
CHANGED
@@ -7,13 +7,24 @@ class Expectations::Suite
|
|
7
7
|
def execute(out=STDOUT)
|
8
8
|
suite_result = Expectations::SuiteResults.new(out)
|
9
9
|
benchmark = Benchmark.measure do
|
10
|
-
|
11
|
-
suite_result << expectation.execute
|
12
|
-
end
|
10
|
+
ENV["LINE"].nil? ? run_all(suite_result) : run_one(suite_result)
|
13
11
|
end
|
14
12
|
suite_result.print_results(benchmark)
|
15
13
|
suite_result.result
|
16
14
|
end
|
15
|
+
|
16
|
+
def run_all(suite_result)
|
17
|
+
expectations.each do |expectation|
|
18
|
+
suite_result << expectation.execute
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def run_one(suite_result)
|
23
|
+
one = expectations.inject do |result, expectation|
|
24
|
+
expectation.line > ENV["LINE"].to_i ? result : expectation
|
25
|
+
end
|
26
|
+
suite_result << one.execute
|
27
|
+
end
|
17
28
|
|
18
29
|
def expectations
|
19
30
|
@expectations ||= []
|
data/rakefile.rb
CHANGED
@@ -41,7 +41,7 @@ specification = Gem::Specification.new do |s|
|
|
41
41
|
expect NoMethodError do
|
42
42
|
Object.invalid_method_call
|
43
43
|
end."
|
44
|
-
s.version = "0.0.
|
44
|
+
s.version = "0.0.8"
|
45
45
|
s.author = 'Jay Fields'
|
46
46
|
s.description = "A lightweight unit testing framework. Tests (expectations) will be written as follows
|
47
47
|
expect 2 do
|