Created
August 24, 2009 17:24
-
-
Save anonymous/173973 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "#{File.dirname(__FILE__)}/temperature" | |
describe Temperature do | |
before do | |
@temperature = Temperature.new | |
end | |
describe "#ftoc" do | |
it "converts freezing temperature" do | |
@temperature.ftoc(32).should == 0 | |
end | |
it "converts boiling temperature" do | |
@temperature.ftoc(212).should == 100 | |
end | |
it "converts body temperature" do | |
@temperature.ftoc(98.6).should == 37 | |
end | |
it "converts arbitrary temperature" do | |
@temperature.ftoc(68).should == 20 | |
end | |
end | |
describe "#ctof" do | |
it "converts freezing temperature" do | |
@temperature.ctof(0).should == 32 | |
end | |
it "converts boiling temperature" do | |
@temperature.ctof(100).should == 212 | |
end | |
it "converts arbitrary temperature" do | |
@temperature.ctof(20).should == 68 | |
end | |
it "converts body temperature" do | |
t = @temperature.ctof(37) | |
(t*10).round.should == 986 # see http://www.ruby-forum.com/topic/169330#742994 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment