Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
rcov/ruby/1.8/gems/rspec-mocks-2.5.0/lib/rspec/mocks/spec_methods.rb | 53 | 25 | 69.81%
|
40.00%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 module RSpec |
2 module Mocks |
3 module ExampleMethods |
4 include RSpec::Mocks::ArgumentMatchers |
5 |
6 # Creates an instance of RSpec::Mocks::Mock. |
7 # |
8 # +name+ is used for failure reporting, so you should use the role that |
9 # the mock is playing in the example. |
10 # |
11 # Use +stubs+ to declare one or more method stubs in one statement. |
12 # |
13 # == Examples |
14 # |
15 # book = double("book", :title => "The RSpec Book") |
16 # book.title => "The RSpec Book" |
17 # |
18 # card = double("card", :suit => "Spades", :rank => "A" |
19 # card.suit => "Spades" |
20 # card.rank => "A" |
21 def double(*args) |
22 declare_double('Double', *args) |
23 end |
24 |
25 # Just like double, but use double |
26 def mock(*args) |
27 declare_double('Mock', *args) |
28 end |
29 |
30 # Just like double, but use double |
31 def stub(*args) |
32 declare_double('Stub', *args) |
33 end |
34 |
35 # Disables warning messages about expectations being set on nil. |
36 # |
37 # By default warning messages are issued when expectations are set on nil. This is to |
38 # prevent false-positives and to catch potential bugs early on. |
39 def allow_message_expectations_on_nil |
40 Proxy.allow_message_expectations_on_nil |
41 end |
42 |
43 private |
44 |
45 def declare_double(declared_as, *args) |
46 args << {} unless Hash === args.last |
47 args.last[:__declared_as] = declared_as |
48 RSpec::Mocks::Mock.new(*args) |
49 end |
50 |
51 end |
52 end |
53 end |
Generated on Fri Apr 22 17:22:41 -0700 2011 with rcov 0.9.8