Module: MiniTestSpecRails::DSL::ClassMethods

Defined in:
lib/minitest-spec-rails/dsl.rb

Instance Method Summary collapse

Instance Method Details

#after(_type = nil, &block) ⇒ Object



20
21
22
# File 'lib/minitest-spec-rails/dsl.rb', line 20

def after(_type = nil, &block)
  teardown { instance_eval(&block) }
end

#before(_type = nil, &block) ⇒ Object



16
17
18
# File 'lib/minitest-spec-rails/dsl.rb', line 16

def before(_type = nil, &block)
  setup { instance_eval(&block) }
end

#describe(*args, &block) ⇒ Object



9
10
11
12
13
14
# File 'lib/minitest-spec-rails/dsl.rb', line 9

def describe(*args, &block)
  stack = Minitest::Spec.describe_stack
  stack.push self if stack.empty?
  super(*args) { class_eval(&block) }
  stack.pop if stack.length == 1
end

#described_classObject



28
29
30
# File 'lib/minitest-spec-rails/dsl.rb', line 28

def described_class
  nil
end

#test(name, &block) ⇒ Object



24
25
26
# File 'lib/minitest-spec-rails/dsl.rb', line 24

def test(name, &block)
  instance_eval { it(name, &block) }
end