Class: MinitestToRspec::Subprocessors::Klass

Inherits:
Base
  • Object
show all
Defined in:
lib/minitest_to_rspec/subprocessors/klass.rb

Overview

Processes ‘s(:class, ..)` expressions.

Instance Method Summary collapse

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) ⇒ Klass

Takes ‘sexp`, a `:class` s-expression, and `rails`, a boolean indicating that `rspec-rails` conventions (like `:type` metadata) should be used.



14
15
16
17
18
# File 'lib/minitest_to_rspec/subprocessors/klass.rb', line 14

def initialize(sexp, rails, mocha)
  super(rails, mocha)
  @exp = Model::Klass.new(sexp)
  sexp.clear
end

Instance Method Details

#processObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/minitest_to_rspec/subprocessors/klass.rb', line 20

def process
  sexp = head
  ebk = @exp.block
  if ebk.length > 1
    sexp << block
  elsif ebk.length == 1
    sexp << full_process(ebk[0])
  end
  sexp
end