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 143
143:   def self.after type = :each, &block
144:     raise "unsupported after type: #{type}" unless type == :each
145:     define_inheritable_method :teardown, &block
146:   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 131
131:   def self.before type = :each, &block
132:     raise "unsupported before type: #{type}" unless type == :each
133:     define_inheritable_method :setup, &block
134:   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 157
157:   def self.it desc, &block
158:     block ||= proc { skip "(no tests defined)" }
159: 
160:     @specs ||= 0
161:     @specs += 1
162: 
163:     name = "test_%04d_%s" % [ @specs, desc.gsub(/\W+/, '_').downcase ]
164: 
165:     define_method name, &block
166: 
167:     classes(MiniTest::Spec).each do |mod|
168:       mod.send :undef_method, name if mod.respond_to? name
169:     end
170:   end

Public Instance Methods

must_be click to toggle source

See MiniTest::Assertions#assert

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

See MiniTest::Assertions#assert_in_delta

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

See MiniTest::Assertions#assert_empty

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

See MiniTest::Assertions#assert_instance_of

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

See MiniTest::Assertions#assert_kind_of

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

See MiniTest::Assertions#assert_nil

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

See MiniTest::Assertions#assert_same

     # File lib/minitest/spec.rb, line 200
200:   
must_be_silent click to toggle source

See MiniTest::Assertions#assert_silent

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

See MiniTest::Assertions#assert_in_delta

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

See MiniTest::Assertions#assert_in_epsilon

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

See MiniTest::Assertions#assert_equal

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

See MiniTest::Assertions#assert_includes

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

See MiniTest::Assertions#assert_match

     # File lib/minitest/spec.rb, line 224
224:   
must_output click to toggle source

See MiniTest::Assertions#assert_output

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

See MiniTest::Assertions#assert_raises

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

See MiniTest::Assertions#assert_respond_to

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

See MiniTest::Assertions#assert_send

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

See MiniTest::Assertions#assert_throw

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

See MiniTest::Assertions#refute

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

See MiniTest::Assertions#refute_in_delta

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

See MiniTest::Assertions#refute_empty

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

See MiniTest::Assertions#refute_instance_of

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

See MiniTest::Assertions#refute_kind_of

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

See MiniTest::Assertions#refute_nil

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

See MiniTest::Assertions#refute_same

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

See MiniTest::Assertions#refute_in_delta

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

See MiniTest::Assertions#refute_in_delta

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

See MiniTest::Assertions#refute_in_epsilon

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

See MiniTest::Assertions#refute_equal

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

See MiniTest::Assertions#refute_includes

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

See MiniTest::Assertions#refute_match

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

See MiniTest::Assertions#refute_respond_to

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.