Module: Quacky::Expectations
- Defined in:
- lib/quacky/rspec_setup.rb,
lib/quacky/expectations.rb,
lib/quacky/minitest_setup.rb
Instance Method Summary collapse
- #expect(method_name, return_value, with = []) ⇒ Object
- #quacky_stub(method_name, &block) ⇒ Object
- #should_receive(method_name) ⇒ Object
- #stub(method_name, return_value, with = []) ⇒ Object
Instance Method Details
#expect(method_name, return_value, with = []) ⇒ Object
19 20 21 22 23 |
# File 'lib/quacky/minitest_setup.rb', line 19 def expect method_name, return_value, with=[] should_receive(method_name).and_return(return_value).tap do |expectation| expectation.with(*with) unless with.empty? end end |
#quacky_stub(method_name, &block) ⇒ Object
7 8 9 |
# File 'lib/quacky/expectations.rb', line 7 def quacky_stub method_name, &block setup_expectation method_name, &block end |
#should_receive(method_name) ⇒ Object
11 12 13 14 15 |
# File 'lib/quacky/expectations.rb', line 11 def should_receive method_name quacky_stub(method_name).tap do |expectation| Quacky.expectations << expectation end end |
#stub(method_name, return_value, with = []) ⇒ Object
7 |
# File 'lib/quacky/rspec_setup.rb', line 7 alias :stub :quacky_stub |