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
- mock.verify
8
+ expected.verify
9
9
  self.extend(Expectations::Results::Fulfilled)
10
10
  rescue Mocha::ExpectationError => ex
11
11
  self.extend(Expectations::Results::BehaviorFailure)
@@ -21,6 +21,10 @@ class Expectations::MockRecorder
21
21
  target
22
22
  end
23
23
 
24
+ def verify
25
+ target.verify
26
+ end
27
+
24
28
  class MockEvent
25
29
  attr_accessor :method, :args
26
30
  def initialize(method, args)
@@ -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
- expectations.each do |expectation|
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.7"
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expectations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jay Fields