Class: MinitestToRspec::Subprocessors::Defn
- Defined in:
- lib/minitest_to_rspec/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 MinitestToRspec::SexpAssertions
#assert_sexp_type, #assert_sexp_type_array, #sexp_type?
Constructor Details
#initialize(sexp, rails, mocha) ⇒ Defn
Returns a new instance of Defn.
11 12 13 14 15 16 |
# File 'lib/minitest_to_rspec/subprocessors/defn.rb', line 11 def initialize(sexp, rails, mocha) super(rails, mocha) @original = sexp.dup @exp = Model::Defn.new(sexp) sexp.clear end |
Instance Method Details
#process ⇒ Object
Using a ‘Model::Defn`, returns a `Sexp`
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/minitest_to_rspec/subprocessors/defn.rb', line 19 def process if @exp.test_method? s(:iter, s(:call, nil, :it, s(:str, example_title)), 0, example_block) else @original end end |