Kernel extensions for minitest
Describe a series of expectations for a given target
class MySpec < Minitest::Spec # ... shared code ... end class TestStuff < MySpec it "does stuff" do # shared code available here end describe "inner stuff" do it "still does stuff" do # ...and here end end end
For more information on getting started with writing specs, see:
For some suggestions on how to improve your specs, try:
but do note that several items there are debatable or specific to rspec.
For more information about expectations, see Minitest::Expectations.
# File lib/minitest/spec.rb, line 71 def describe desc, *additional_desc, &block # :doc: stack = Minitest::Spec.describe_stack name = [stack.last, desc, *additional_desc].compact.join("::") sclas = stack.last || if Class === self && kind_of?(Minitest::Spec::DSL) then self else Minitest::Spec.spec_type desc, *additional_desc end cls = sclas.create name, desc stack.push cls cls.class_eval(&block) stack.pop cls end
© Ryan Davis, seattle.rb
Licensed under the MIT License.