Sha256: f50c228a4db9ec5ea2ef20fd8523b0ff3ff7a33a80670bca3c8422fcb4e7f354

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

require "minitest/autorun"
require "minitest/should"
begin; require "turn"; rescue LoadError; end

class TestMiniTestShould < MiniTest::Unit::TestCase

  def setup
    @something = "nothing"
  end
  
  def nothing
    "blank"
  end

  def test_version
    assert_equal String, MiniTest::Should::VERSION.class
  end
  
  def test_includes_minitest_should_base_module
    assert self.class.included_modules.include?(MiniTest::Should::Base)
  end
  
  def test_respond_to_should
    assert self.class.respond_to?(:should)
  end
  
  should "just work" do
    assert true
  end
  
  should "create method from string" do
    assert self.class.test_methods.include?("test_should_create_method_from_string")
  end
  
  should "work with multiple assertions" do
    assert_block do 
      1 == 2 / 2
    end
    assert_raises NameError do
      zomg
    end
    assert_instance_of String, "woo hoo"
    assert_equal 2, 1 + 1    
  end
  
  should "work with the tests instance variables" do
    assert_equal "nothing", @something
  end
  
  should "work with the tests instance methods" do
    assert_equal "blank", nothing
  end
  
  def test_should_warn_on_duplicate_method_names
    assert_raises MiniTest::Should::DuplicateMethodError do
      self.class.send(:should, "warn on duplicate method names") do
        assert true
      end
    end  
  end  
  
  should "also warn on duplicate method names" do
    assert_raises MiniTest::Should::DuplicateMethodError do 
      self.class.send(:should, "also warn on duplicate method names") do
        assert true
      end
    end 
  end
      
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
minitest_should-0.1.0 test/test_minitest_should.rb