Sha256: 0fa5f51cda46a883c8a6c39a5005cd8f5b46a2b77443a1fa38e65aff2cfb92b9

Contents?: true

Size: 1.88 KB

Versions: 80

Compression:

Stored size: 1.88 KB

Contents

# Specs:                               # Equivalent Unit Tests:
###############################################################################
describe Thingy do                     # class TestThingy < MiniTest::Unit::TestCase
  before do                            #   def setup
    do_some_setup                      #     super
  end                                  #     do_some_setup
                                       #   end
  it "should do the first thing" do    #
    1.must_equal 1                     #   def test_first_thing
  end                                  #     assert_equal 1, 1
                                       #   end
  describe SubThingy do                # end
    before do                          #
      do_more_setup                    # class TestSubThingy < TestThingy
    end                                #   def setup
                                       #     super
    it "should do the second thing" do #     do_more_setup
      2.must_equal 2                   #   end
    end                                #
  end                                  #   def test_second_thing
end                                    #     assert_equal 2, 2
                                       #   end
                                       # end
###############################################################################
# runs 2 specs                         # runs 3 tests
###############################################################################
# The specs generate:

class ThingySpec < MiniTest::Spec
  def setup
    super
    do_some_setup
  end

  def test_should_do_the_first_thing
    assert_equal 1, 1
  end
end

class SubThingySpec < ThingySpec
  def setup
    super
    do_more_setup
  end

  # because only setup/teardown is inherited, not specs
  remove_method :test_should_do_the_first_thing

  def test_should_do_the_second_thing
    assert_equal 2, 2
  end
end

Version data entries

80 entries across 77 versions & 6 rubygems

Version Path
mattly-minitest-1.4.2.1 design_rationale.rb
mattly-minitest-1.4.2.2 design_rationale.rb
mattly-minitest-1.4.2.3 design_rationale.rb
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/minitest-2.5.1/design_rationale.rb
challah-1.0.0 vendor/bundle/gems/minitest-4.7.5/design_rationale.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/minitest-2.5.1/design_rationale.rb
minitest-4.7.5 design_rationale.rb
swipe-rails-0.0.5 vendor/bundle/gems/minitest-4.7.4/design_rationale.rb
challah-1.0.0.beta3 vendor/bundle/gems/minitest-4.7.1/design_rationale.rb
challah-1.0.0.beta3 vendor/bundle/gems/minitest-4.7.0/design_rationale.rb
challah-1.0.0.beta3 vendor/bundle/gems/minitest-4.7.4/design_rationale.rb
minitest-4.7.4 design_rationale.rb
minitest-4.7.3 design_rationale.rb
minitest-4.7.2 design_rationale.rb
challah-1.0.0.beta2 vendor/bundle/gems/minitest-4.7.0/design_rationale.rb
challah-1.0.0.beta2 vendor/bundle/gems/minitest-4.7.1/design_rationale.rb
challah-1.0.0.beta vendor/bundle/gems/minitest-4.7.0/design_rationale.rb
minitest-4.7.1 design_rationale.rb
minitest-4.7.0 design_rationale.rb
minitest-4.6.2 design_rationale.rb