Sha256: 7745e6c7e5441fa6e8d25d112a364202d05b55778de6257c2fe60531933516d6

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

require 'minitest_helper'
require 'canada'

class CanadaTest < MiniTest::Test
  def test_eh?
    assert [].empty_eh?
    refute [1,2,3].empty_eh?
  end

  def test_respond_to_eh?
    yes = [:empty?, :empty_eh?, :respond_to?, :respond_to_eh?]
    no = [:not_there, :not_there?, :not_there_eh, :not_there_eh?]

    yes.each { |y| assert([].respond_to_eh?(y), "Array should respond_to_eh? #{y}") }
    no.each { |n| refute([].respond_to_eh?(n), "Array should not respond_to_eh? #{n}") }
  end

  def test_respond_to?
    yes = [:empty?, :empty_eh?, :respond_to?, :respond_to_eh?]
    no = [:not_there, :not_there?, :not_there_eh, :not_there_eh?]

    yes.each { |y| assert([].respond_to?(y), "Array should respond_to_eh? #{y}") }
    no.each { |n| refute([].respond_to?(n), "Array should not respond_to_eh? #{n}") }
  end

  def test_aboot
    cases = [
      [],
      [1,2,3],
      {},
      {a: 1, b: 2},
      Object.new,
      true,
      false,
      nil
    ]

    cases.each { |c| assert_equal c.inspect, aboot(c) }
  end

  def test_exceptions_to_s
    assert_equal "I'm sorry, but something went wrong...", Exception.new("something went wrong...").to_s
    assert_equal "I'm sorry, but something went wrong...", Exception.new("something went wrong...").message
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
canada-0.0.3 test/canada_test.rb
canada-0.0.2 test/canada_test.rb