Last active
August 29, 2015 14:15
-
-
Save chrisbodhi/b7b10f5e428088fa38da 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
require 'minitest/autorun' | |
class RobotTest < MiniTest::Unit::TestCase | |
def test_name_sticks | |
robot = Robot.new | |
robot.name | |
assert_equal robot.name, robot.name | |
end | |
end | |
class Robot | |
def initialize | |
@name = '' | |
end | |
def name | |
2.times {@name << ('A'..'Z').to_a.sample} | |
3.times {@name << (0..9).to_a.sample.to_s} | |
@name | |
end | |
def reset | |
@name = '' | |
end | |
end | |
# via exercism.io |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment