MiniTest::Spec

Public Class Methods

after(type = :each, &block) click to toggle source

Define an 'after' action. Inherits the way normal methods should.

NOTE: type is ignored and is only there to make porting easier.

Equivalent to MiniTest::Unit::TestCase#teardown.

# File lib/minitest/spec.rb, line 142
def self.after type = :each, &block
  raise "unsupported after type: #{type}" unless type == :each
  define_inheritable_method :teardown, &block
end
before(type = :each, &block) click to toggle source

Define a 'before' action. Inherits the way normal methods should.

NOTE: type is ignored and is only there to make porting easier.

Equivalent to MiniTest::Unit::TestCase#setup.

# File lib/minitest/spec.rb, line 130
def self.before type = :each, &block
  raise "unsupported before type: #{type}" unless type == :each
  define_inheritable_method :setup, &block
end
it(desc, &block) click to toggle source

Define an expectation with name desc. Name gets morphed to a proper test method name. For some freakish reason, people who write specs don't like class inheritence, so this goes way out of its way to make sure that expectations aren't inherited.

Hint: If you do want inheritence, use minitest/unit. You can mix and match between assertions and expectations as much as you want.

# File lib/minitest/spec.rb, line 156
def self.it desc, &block
  block ||= proc { skip "(no tests defined)" }

  @specs ||= 0
  @specs += 1

  name = "test_%04d_%s" % [ @specs, desc.gsub(/\W+/, '_').downcase ]

  define_method name, &block

  classes(MiniTest::Spec).each do |mod|
    mod.send :undef_method, name if mod.respond_to? name
  end
end

Public Instance Methods

must_be click to toggle source

See MiniTest::Assertions#assert

# File lib/minitest/spec.rb, line 175
  
must_be_close_to click to toggle source

See MiniTest::Assertions#assert_in_delta

# File lib/minitest/spec.rb, line 179
  
must_be_empty click to toggle source

See MiniTest::Assertions#assert_empty

# File lib/minitest/spec.rb, line 183
  
must_be_instance_of click to toggle source

See MiniTest::Assertions#assert_instance_of

# File lib/minitest/spec.rb, line 187
  
must_be_kind_of click to toggle source

See MiniTest::Assertions#assert_kind_of

# File lib/minitest/spec.rb, line 191
  
must_be_nil click to toggle source

See MiniTest::Assertions#assert_nil

# File lib/minitest/spec.rb, line 195
  
must_be_same_as click to toggle source

See MiniTest::Assertions#assert_same

# File lib/minitest/spec.rb, line 199
  
must_be_within_delta click to toggle source

See MiniTest::Assertions#assert_in_delta

# File lib/minitest/spec.rb, line 203
  
must_be_within_epsilon click to toggle source

See MiniTest::Assertions#assert_in_epsilon

# File lib/minitest/spec.rb, line 207
  
must_equal click to toggle source

See MiniTest::Assertions#assert_equal

# File lib/minitest/spec.rb, line 211
  
must_include click to toggle source

See MiniTest::Assertions#assert_includes

# File lib/minitest/spec.rb, line 215
  
must_match click to toggle source

See MiniTest::Assertions#assert_match

# File lib/minitest/spec.rb, line 219
  
must_raise click to toggle source

See MiniTest::Assertions#assert_raises

# File lib/minitest/spec.rb, line 223
  
must_respond_to click to toggle source

See MiniTest::Assertions#assert_respond_to

# File lib/minitest/spec.rb, line 227
  
must_send click to toggle source

See MiniTest::Assertions#assert_send

# File lib/minitest/spec.rb, line 231
  
must_throw click to toggle source

See MiniTest::Assertions#assert_throw

# File lib/minitest/spec.rb, line 235
  
wont_be click to toggle source

See MiniTest::Assertions#refute

# File lib/minitest/spec.rb, line 239
  
wont_be_close_to click to toggle source

See MiniTest::Assertions#refute_in_delta

# File lib/minitest/spec.rb, line 243
  
wont_be_empty click to toggle source

See MiniTest::Assertions#refute_empty

# File lib/minitest/spec.rb, line 247
  
wont_be_instance_of click to toggle source

See MiniTest::Assertions#refute_instance_of

# File lib/minitest/spec.rb, line 251
  
wont_be_kind_of click to toggle source

See MiniTest::Assertions#refute_kind_of

# File lib/minitest/spec.rb, line 255
  
wont_be_nil click to toggle source

See MiniTest::Assertions#refute_nil

# File lib/minitest/spec.rb, line 259
  
wont_be_same_as click to toggle source

See MiniTest::Assertions#refute_same

# File lib/minitest/spec.rb, line 263
  
wont_be_within_delta click to toggle source

See MiniTest::Assertions#refute_in_delta

# File lib/minitest/spec.rb, line 267
  
wont_be_within_epsilon click to toggle source

See MiniTest::Assertions#refute_in_epsilon

# File lib/minitest/spec.rb, line 271
  
wont_equal click to toggle source

See MiniTest::Assertions#refute_equal

# File lib/minitest/spec.rb, line 275
  
wont_include click to toggle source

See MiniTest::Assertions#refute_includes

# File lib/minitest/spec.rb, line 279
  
wont_match click to toggle source

See MiniTest::Assertions#refute_match

# File lib/minitest/spec.rb, line 283
  
wont_respond_to click to toggle source

See MiniTest::Assertions#refute_respond_to

# File lib/minitest/spec.rb, line 286

[Validate]

Generated with the Darkfish Rdoc Generator 2.