Sha256: 5471be3fc1c90108f8ada34d01f65d350b9ed6a296a65b0c09b775d95738b92e

Contents?: true

Size: 436 Bytes

Versions: 1

Compression:

Stored size: 436 Bytes

Contents

# -*- coding: utf-8 -*-
require 'bacon'
require 'unit'
require 'unit/dsl'

describe "Errors" do
  describe "TypeError when adding incompatible units" do
    it "should have a nice error message" do
      unit_1 = Unit(1, "meter")
      unit_2 = Unit(1, "second")
      lambda {
        unit_1 + unit_2
      }.should.raise(TypeError).message.should.equal("Incompatible units: #{unit_1.inspect} and #{unit_2.inspect}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
unit-0.3.0 test/error_test.rb