Sha256: 8ed33579b7dc5a4ae9d37640b5551aab04c45cd9a99a3a2bb41354dda618a6e0

Contents?: true

Size: 1.21 KB

Versions: 3

Compression:

Stored size: 1.21 KB

Contents

require "spec_helper"

describe UnitsConverter do
  specify "converting metres to metres" do
    expect(["0.01", :metres]).to be_converted_to(["0.01", :metres])
    expect(["1", :metres]).to be_converted_to(["1", :metres])
    expect(["100", :metres]).to be_converted_to(["100", :metres])
  end

  specify "conveting metres to non-metres" do
    expect(["0.01", :metres]).to be_converted_to(["1", :centimetre])
    expect(["1", :metre]).to be_converted_to(["100", :centimetres])
    expect(["100", :metres]).to be_converted_to(["10000", :centimetres])
  end

  specify "converting non-metres to metres" do
    expect(["0.01", :centimetres]).to be_converted_to(["0.0001", :metres])
    expect(["1", :centimetre]).to be_converted_to(["0.01", :metres])
    expect(["100", :centimetres]).to be_converted_to(["1", :metres])
  end

  specify "converting non-metres to other non-metres" do
    expect(["1", :centimetre]).to be_converted_to(["0.00001", :kilometres])
    expect(["1", :kilometre]).to be_converted_to(["100000", :centimetres])
  end

  specify "converting to and from unit with irregular plural" do
    expect(["1", :foot]).to be_converted_to(["12", :inches])
    expect(["1", :yard]).to be_converted_to(["3", :feet])
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
units_converter-0.0.3 spec/units_converter_spec.rb
units_converter-0.0.2 spec/units_converter_spec.rb
units_converter-0.0.1 spec/units_converter_spec.rb