Sha256: 14e2ff95aed1bbfe3d3fa3af9f7068776f28e98bb065a27b918b4ef9763a4414

Contents?: true

Size: 1.97 KB

Versions: 27

Compression:

Stored size: 1.97 KB

Contents

# -*- ruby -*-

require "rubygems"
require "hoe"

Hoe.plugin :seattlerb
Hoe.plugin :rdoc

Hoe.spec "minitest" do
  developer "Ryan Davis", "ryand-ruby@zenspider.com"

  license "MIT"

  self.testlib = :minitest
end

desc "Find missing expectations"
task :specs do
  $:.unshift "lib"
  require "minitest/unit"
  require "minitest/spec"

  pos_prefix, neg_prefix = "must", "wont"
  skip_re = /^(must|wont)$|wont_(throw)|must_(block|not?_|nothing|raise$)/x
  dont_flip_re = /(must|wont)_(include|respond_to)/

  map = {
    /(must_throw)s/                        => '\1',
    /(?!not)_same/                         => "_be_same_as",
    /_in_/                                 => "_be_within_",
    /_operator/                            => "_be",
    /_includes/                            => "_include",
    /(must|wont)_(.*_of|nil|silent|empty)/ => '\1_be_\2',
    /must_raises/                          => "must_raise",
  }

  expectations = Minitest::Expectations.public_instance_methods.map(&:to_s)
  assertions   = Minitest::Assertions.public_instance_methods.map(&:to_s)

  assertions.sort.each do |assertion|
    expectation = case assertion
                  when /^assert/ then
                    assertion.sub(/^assert/, pos_prefix.to_s)
                  when /^refute/ then
                    assertion.sub(/^refute/, neg_prefix.to_s)
                  end

    next unless expectation
    next if expectation =~ skip_re

    regexp, replacement = map.find { |re, _| expectation =~ re }
    expectation.sub! regexp, replacement if replacement

    next if expectations.include? expectation

    args = [assertion, expectation].map(&:to_sym).map(&:inspect)
    args << :reverse if expectation =~ dont_flip_re

    puts
    puts "##"
    puts "# :method: #{expectation}"
    puts "# See Minitest::Assertions##{assertion}"
    puts
    puts "infect_an_assertion #{args.join ", "}"
  end
end

task :bugs do
  sh "for f in bug*.rb ; do echo $f; echo; #{Gem.ruby} -Ilib $f && rm $f ; done"
end

# vim: syntax=Ruby

Version data entries

27 entries across 26 versions & 11 rubygems

Version Path
mercadopago-custom-checkout-0.1.2 .gs/gems/minitest-5.9.0/Rakefile
mercadopago-custom-checkout-0.1.1 .gs/gems/minitest-5.9.0/Rakefile
abaci-0.3.0 vendor/bundle/gems/minitest-5.9.0/Rakefile
second_step-0.1.2 secondstep-notify-1.0.0-osx/lib/ruby/lib/ruby/gems/2.2.0/gems/minitest-5.9.1/Rakefile
minitest-5.9.1 Rakefile
minitest-5.8.5 Rakefile
windows-pr-1.2.5 vendor/bundle/ruby/2.2.0/gems/minitest-5.9.0/Rakefile
minitest-5.9.0 Rakefile
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/minitest-5.8.4/Rakefile
minitest-5.8.4 Rakefile
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/minitest-5.8.0/Rakefile
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/minitest-5.8.0/Rakefile
tdiary-4.2.1 vendor/bundle/ruby/2.2.0/gems/minitest-5.8.3/Rakefile
tdiary-4.2.1 vendor/bundle/ruby/2.3.0/gems/minitest-5.8.3/Rakefile
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/minitest-5.8.0/Rakefile
minitest-5.8.3 Rakefile
minitest-5.8.2 Rakefile
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/minitest-5.8.1/Rakefile
minitest-5.8.1 Rakefile
minitest-5.8.0 Rakefile