Class: MinitestToRspec::Subprocessors::Call
- Defined in:
- lib/minitest_to_rspec/subprocessors/call.rb
Overview
Processes ‘s(:call, ..)` expressions.
Constant Summary collapse
- MOCHA_METHODS =
Mocha methods will only be processed if ‘–mocha` flag was given, i.e. `mocha` argument in constructor is true.
i[ expects once returns stub stubs stub_everything twice ].freeze
Instance Method Summary collapse
-
#initialize(sexp, rails, mocha) ⇒ Call
constructor
A new instance of Call.
-
#process ⇒ Object
Given a ‘Model::Call`, returns a `Sexp`.
- #process? ⇒ Boolean
Methods inherited from Base
#allow_to, #expect, #expect_to, #expect_to_not, #expectation_target, #expectation_target_eager, #expectation_target_lazy, #full_process, #matcher
Methods included from MinitestToRspec::SexpAssertions
#assert_sexp_type, #assert_sexp_type_array, #sexp_type?
Constructor Details
#initialize(sexp, rails, mocha) ⇒ Call
Returns a new instance of Call.
24 25 26 27 28 |
# File 'lib/minitest_to_rspec/subprocessors/call.rb', line 24 def initialize(sexp, rails, mocha) super(rails, mocha) @exp = Model::Call.new(sexp) sexp.clear end |
Instance Method Details
#process ⇒ Object
Given a ‘Model::Call`, returns a `Sexp`
31 32 33 34 35 36 37 |
# File 'lib/minitest_to_rspec/subprocessors/call.rb', line 31 def process if process? send(name_of_processing_method) else @exp.original end end |
#process? ⇒ Boolean
39 40 41 42 |
# File 'lib/minitest_to_rspec/subprocessors/call.rb', line 39 def process? respond_to?(name_of_processing_method, true) && (@mocha || !MOCHA_METHODS.include?(@exp.method_name)) end |