-
-
Save klmlfl/e2a3400582c0a2d3d861 to your computer and use it in GitHub Desktop.
This file contains 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
MiniTest::Unit::TestCase is now Minitest::Test. From roman_numerals_test.rb:4:in `<main>' | |
Run options: --seed 59009 | |
# Running: | |
ESSSSSSSSSSSSSSSSS | |
Finished in 0.005068s, 3551.6969 runs/s, 0.0000 assertions/s. | |
1) Error: | |
RomanTest#test_1: | |
NoMethodError: undefined method `to_roman' for 1:Fixnum | |
roman_numerals_test.rb:7:in `test_1' | |
18 runs, 0 assertions, 0 failures, 1 errors, 17 skips | |
You have skipped tests. Run with --verbose for details. | |
--------------------------------------------------------------------- | |
class Roman | |
roman_numerals_values = {1000 => 'M',500 => 'D', 100 => 'C', 50 => 'L', 10 => 'X', 5 => 'V', 1 => 'I'} | |
string = nil | |
def self.to_roman | |
roman_numerals_values.each do |k,v| | |
if number - k >= 0 | |
string << v | |
end | |
string | |
end | |
end | |
end | |
----------------------------------------------------------- | |
require 'minitest/autorun' | |
require_relative 'roman' | |
class RomanTest < MiniTest::Unit::TestCase | |
def test_1 | |
assert_equal 'I', 1.to_roman | |
end | |
def test_2 | |
skip | |
assert_equal 'II', 2.to_roman | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment