From bff3d822d1f20edfa6122fdd935bf5d91391f766 Mon Sep 17 00:00:00 2001 From: ThePomodoro Date: Sat, 18 Jan 2014 12:15:58 -0800 Subject: [PATCH] Added feature converting furlongs to km using Rspec --- .idea/encodings.xml | 5 ++++ .idea/furlong.iml | 48 +++++++++++++++++++++++++++++++++ .idea/misc.xml | 5 ++++ .idea/modules.xml | 9 +++++++ .idea/scopes/scope_settings.xml | 5 ++++ .idea/vcs.xml | 7 +++++ furlong.rb | 6 ++++- furlong_spec.rb | 6 ++++- 8 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 .idea/encodings.xml create mode 100644 .idea/furlong.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/furlong.iml b/.idea/furlong.iml new file mode 100644 index 0000000..43e5780 --- /dev/null +++ b/.idea/furlong.iml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..78d2e82 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f78e340 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c80f219 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/furlong.rb b/furlong.rb index 9b7e2b4..7d46772 100644 --- a/furlong.rb +++ b/furlong.rb @@ -1,7 +1,11 @@ class Furlong KM_PER_MILE = 1.60934 + KM_PER_FURLONG = 0.201168 def miles_to_kilometers(miles) miles * KM_PER_MILE - end + end + def furlongs_to_km(furlongs) + furlongs * KM_PER_FURLONG + end end \ No newline at end of file diff --git a/furlong_spec.rb b/furlong_spec.rb index 053ebfd..6d9ad78 100644 --- a/furlong_spec.rb +++ b/furlong_spec.rb @@ -11,5 +11,9 @@ 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 + + it "converts 1 furlong to 0.125 miles" do + subject.furlongs_to_km(1).should be_within(0.001).of(0.201168) + end end \ No newline at end of file