Sha256: 641c74104c8203371b828252f58159c3774db902ee0e87509116776981333386

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
require File.expand_path 'test_helper', File.dirname(__FILE__)

class TestBiteTheDust < MiniTest::Unit::TestCase
  def setup
    @bitethedust = BiteTheDust::BiteTheDust.new(Time.now+5)
    @future = Time.new(2100-01-01)
    @past = Time.new(1900-01-01)    
  end

  def test_self_future?
    assert_respond_to BiteTheDust, :future?
    assert BiteTheDust.future?(@future)
    refute BiteTheDust.future?(@past)
  end

  def test_self_countdown
    assert_respond_to BiteTheDust, :countdown
  end

  def test_initialize
    assert_raises(ArgumentError) { BiteTheDust::BiteTheDust.new }
    assert_instance_of BiteTheDust::BiteTheDust, BiteTheDust::BiteTheDust.new(Time.new(2100-01-01))
  end

  def test_future?
    assert_respond_to(@bitethedust, :future?)
    assert BiteTheDust::BiteTheDust.new(@future).future?
    refute BiteTheDust::BiteTheDust.new(@past).future?
  end

  def test_set_timer
    assert_respond_to(@bitethedust, :set_timer)
    assert @bitethedust.set_timer(lambda{puts "done"})
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bite_the_dust-0.0.1 test/test_bite_the_dust.rb