Class: MinitestToRspec::Input::Subprocessors::Defn
- Defined in:
- lib/minitest_to_rspec/input/subprocessors/defn.rb
Overview
Minitest tests can be defined as methods using names beginning with ‘test_’. Process those tests into RSpec ‘it` example blocks.
Instance Method Summary collapse
-
#initialize(sexp, rails, mocha) ⇒ Defn
constructor
A new instance of Defn.
-
#process ⇒ Object
Using a ‘Model::Defn`, returns a `Sexp`.
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 SexpAssertions
#assert_sexp_type, #assert_sexp_type_array, #sexp_type?
Constructor Details
Instance Method Details
#process ⇒ Object
Using a ‘Model::Defn`, returns a `Sexp`
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/minitest_to_rspec/input/subprocessors/defn.rb', line 21 def process if @exp.test_method? s(:iter, s(:call, nil, :it, s(:str, example_title)), 0, example_block) elsif @exp.setup? s(:iter, s(:call, nil, :before), 0, example_block ) elsif @exp.teardown? s(:iter, s(:call, nil, :after), 0, example_block ) else @original end end |