Module: Quacky
- Extended by:
- Quacky
- Included in:
- Quacky
- Defined in:
- lib/quacky/stub.rb,
lib/quacky/double.rb,
lib/quacky/quacky.rb,
lib/quacky/rspec_setup.rb,
lib/quacky/expectations.rb,
lib/quacky/minitest_setup.rb,
lib/quacky/minitest_setup.rb,
lib/quacky/duck_type_verifier.rb
Defined Under Namespace
Modules: ClassInspect, Expectations, InstanceInspect, MiniTest
Classes: Double, DuckTypeVerificationFailure, DuckTypeVerifier, MethodSignatureMismatch, NoMethodError, Stub, UnexpectedArguments, UnsatisfiedExpectation
Instance Method Summary
collapse
Instance Method Details
#class_double(name, options) ⇒ Object
Also known as:
class_mock
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/quacky/quacky.rb', line 39
def class_double name, options
class_modules, instance_modules = parse_class_double_options options
Class.new do
extend Expectations
include Expectations
extend ClassInspect
include InstanceInspect
name_class_double name
class_modules.each do |class_module|
extend class_module
end
instance_modules.each do |instance_module|
include instance_module
end
end
end
|
#clear_expectations! ⇒ Object
8
9
10
|
# File 'lib/quacky/quacky.rb', line 8
def clear_expectations!
@expectations = nil
end
|
#double(name, *duck_types) ⇒ Object
Also known as:
mock
12
13
14
15
16
17
18
19
|
# File 'lib/quacky/quacky.rb', line 12
def double(name, *duck_types)
Double.new(name).tap do |object|
duck_types.each do |duck_type|
object.extend duck_type
end
object.extend Expectations
end
end
|
#expectations ⇒ Object
4
5
6
|
# File 'lib/quacky/quacky.rb', line 4
def expectations
@expectations ||= []
end
|