Module: Moarspec::Its::Call
- Defined in:
- lib/moarspec/its/call.rb
Instance Method Summary collapse
-
#its_call(*args, **kwargs, &block) ⇒ Object
For ‘#call`-able subject, creates nested example where subject is called with arguments provided, allowing to apply block matchers like `.to change(something)` or `.to raise_error` to different calls in a DRY way.
Instance Method Details
#its_call(*args, **kwargs, &block) ⇒ Object
For ‘#call`-able subject, creates nested example where subject is called with arguments provided, allowing to apply block matchers like `.to change(something)` or `.to raise_error` to different calls in a DRY way.
Also, plays really well with #ret block matcher.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/moarspec/its/call.rb', line 28 def its_call(*args, **kwargs, &block) # rubocop:disable Lint/NestedMethodDefinition describe("(#{args.map(&:inspect).join(', ')})") do let(:__call_subject) do subject.call(*args, **kwargs) end def is_expected expect { __call_subject } end example(nil, &block) end # rubocop:enable Lint/NestedMethodDefinition end |