require_relative './test_helper' describe Variable do before { @variable = Variable.new(1.0) } it '#initialize' do @variable.must_be_kind_of Struct @variable.must_be_instance_of Variable end it '#value' do @variable.value.must_equal 1.0 end it '#to_s' do @variable.to_s.must_equal '1.0 variables' end it '#inspect' do @variable.inspect.must_equal '1.0 variables' end it '#and' do 0.5.amperes.and(18.ohms).must_equal Volt.new(9.0) 18.ohms.and(9.volts).must_equal Ampere.new(0.5) 9.volts.and(0.5.amperes).must_equal Ohm.new(18.0) end end