Advertisement
Guest User

Untitled

a guest
May 24th, 2015
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. describe "Converting Arabic Numerals to Roman Numerals" do
  2. NUMERAL_TRANSLATIONS = {
  3. 1 => "I",
  4. 2 => "II",
  5. 5 => "V",
  6. 10 => "X"
  7. }
  8. NUMERAL_TRANSLATIONS.each_pair do |arabic, roman|
  9. it "converts #{arabic} to #{roman}" do
  10. expect(arabic_to_roman(arabic)).to eql(roman)
  11. end
  12. end
  13. end
  14.  
  15. ARABIC_TO_ROMAN_MAPPING = {
  16. 1 => "I",
  17. 2 => "II",
  18. 5 => "V",
  19. 10 => "X"
  20. }
  21.  
  22. def arabic_to_roman(number)
  23. ARABIC_TO_ROMAN_MAPPING[number]
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement