Sha256: b839448949764a5cab0e5d83095c30a23e9cfdaa98bdb027ad502545155ca436

Contents?: true

Size: 1.87 KB

Versions: 297

Compression:

Stored size: 1.87 KB

Contents

# Specs:                               # Equivalent Unit Tests:
###############################################################################
describe Thingy do                     # class TestThingy < Minitest::Test
  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

297 entries across 231 versions & 60 rubygems

Version Path
minitest-5.25.2 design_rationale.rb
direct7-0.0.18 vendor/bundle/ruby/2.7.0/gems/minitest-5.20.0/design_rationale.rb
direct7-0.0.18 vendor/bundle/ruby/3.0.0/gems/minitest-5.20.0/design_rationale.rb
direct7-0.0.17 vendor/bundle/ruby/2.7.0/gems/minitest-5.20.0/design_rationale.rb
direct7-0.0.17 vendor/bundle/ruby/3.0.0/gems/minitest-5.20.0/design_rationale.rb
direct7-0.0.16 vendor/bundle/ruby/3.0.0/gems/minitest-5.20.0/design_rationale.rb
direct7-0.0.16 vendor/bundle/ruby/2.7.0/gems/minitest-5.20.0/design_rationale.rb
minitest-5.25.1 design_rationale.rb
minitest-5.25.0 design_rationale.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/minitest-5.24.1/design_rationale.rb
minitest-5.24.1 design_rationale.rb
minitest-5.24.0 design_rationale.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/minitest-5.18.1/design_rationale.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/minitest-5.18.1/design_rationale.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/minitest-5.18.1/design_rationale.rb
katalyst-govuk-formbuilder-1.9.2 vendor/bundle/ruby/3.3.0/gems/minitest-5.23.1/design_rationale.rb
tinymce-rails-7.1.2 vendor/bundle/ruby/3.3.0/gems/minitest-5.23.1/design_rationale.rb
minitest-5.22.3 design_rationale.rb
direct7-0.0.13 vendor/bundle/ruby/3.0.0/gems/minitest-5.20.0/design_rationale.rb
direct7-0.0.13 vendor/bundle/ruby/2.7.0/gems/minitest-5.20.0/design_rationale.rb