Class: Minitest::Spec

Inherits:
Object show all
Defined in:
lib/minitest/mustwonted/spec.rb

Overview

Extra sweets for the Minitest::Spec unit

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Catching up the magick ‘be_smthing?` matchers



31
32
33
34
35
36
37
38
39
# File 'lib/minitest/mustwonted/spec.rb', line 31

def method_missing(name, *args)
  if name.slice(0, 3) == 'be_'
    Minitest::MustWonted::Matcher::Magick.new(name, args)
  elsif respond_to?("assert_#{name}")
    Minitest::MustWonted::Matcher::Legacy.new(name, args, self)
  else
    super name, *args
  end
end

Instance Method Details

#must(*args) ⇒ Object

A shortcut to ‘must` directly on current subject

subject { Something.new }

it { must do_something }


13
14
15
# File 'lib/minitest/mustwonted/spec.rb', line 13

def must(*args)
  subject.must(*args)
end

#wont(*args) ⇒ Object

A shortcut to ‘wont` directly on current subject

subject { Something.new }

it { wont do_something }


24
25
26
# File 'lib/minitest/mustwonted/spec.rb', line 24

def wont(*args)
  subject.wont(*args)
end