diff --git a/furlong.rb b/furlong.rb index 9b7e2b4..f59b260 100644 --- a/furlong.rb +++ b/furlong.rb @@ -1,7 +1,13 @@ class Furlong KM_PER_MILE = 1.60934 + KM_PER_FURLONG = 0.201168 + def miles_to_kilometers(miles) miles * KM_PER_MILE end -end \ No newline at end of file + + def furlong_to_kilometers(furlong) + furlong * KM_PER_FURLONG + end +end diff --git a/furlong_spec.rb b/furlong_spec.rb index 053ebfd..969b2d5 100644 --- a/furlong_spec.rb +++ b/furlong_spec.rb @@ -12,4 +12,8 @@ it "converts a marathon: 26.219 miles to 42.194988 km" do subject.miles_to_kilometers(26.219).should be_within(0.001).of(42.194988) end -end \ No newline at end of file + + it "converts a furlong to a kilometer" do + subject.furlong_to_kilometers(1).should be_within(0.0001).of(0.201168) + end +end