class TiggerTest

  1. src/tigger_test.rb
Superclass: Minitest::Test

Unit tests for the Tigger class.

Methods

Public Instance

  1. test_instance
  2. test_new
  3. test_roar
  4. test_to_s

Public Instance methods

test_instance ()

Verifies that the class has a unique instance every time the instance method gets called.

[show source]
# File src/tigger_test.rb, line 13
def test_instance
  t = Tigger.instance
  assert_same(t, Tigger.instance)
end
test_new ()

Makes sure you cannot call the new method because it should be private.

[show source]
# File src/tigger_test.rb, line 20
def test_new
  assert_raises(NoMethodError) do
    Tigger.new
  end
end
test_roar ()

Checks that the roar method works as expected.

[show source]
# File src/tigger_test.rb, line 33
def test_roar
  t = Tigger.instance
  assert_equal('Grrr!', t.roar)
end
test_to_s ()

Checks that the to_s method works as expected.

[show source]
# File src/tigger_test.rb, line 27
def test_to_s
  t = Tigger.instance
  assert_equal("I'm the only one!", t.to_s)
end