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
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/minitest-5.15.0/design_rationale.rb
plaid-14.13.0 vendor/bundle/ruby/3.0.0/gems/minitest-5.14.2/design_rationale.rb
plaid-14.12.1 vendor/bundle/ruby/3.0.0/gems/minitest-5.14.2/design_rationale.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/minitest-5.11.3/design_rationale.rb
ric-0.14.2 vendor/bundle/ruby/2.7.0/gems/minitest-5.15.0/design_rationale.rb
ric-0.14.1 vendor/bundle/ruby/2.7.0/gems/minitest-5.15.0/design_rationale.rb
plaid-14.12.0 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.2/design_rationale.rb
plaid-14.11.1 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.2/design_rationale.rb
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/minitest-5.15.0/design_rationale.rb
ric-0.14.0 vendor/bundle/ruby/2.7.0/gems/minitest-5.15.0/design_rationale.rb
minitest-5.15.0 design_rationale.rb
plaid-14.10.0 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.2/design_rationale.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.4/design_rationale.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.4/design_rationale.rb
plaid-14.7.0 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.2/design_rationale.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/minitest-5.14.4/design_rationale.rb
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/minitest-5.14.4/design_rationale.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/minitest-5.14.4/design_rationale.rb
minitest-5.14.4 design_rationale.rb
minitest-5.14.3 design_rationale.rb