Skip to content

Instantly share code, notes, and snippets.

@chrisbodhi
Last active August 29, 2015 14:15
Show Gist options
  • Save chrisbodhi/b7b10f5e428088fa38da to your computer and use it in GitHub Desktop.
Save chrisbodhi/b7b10f5e428088fa38da to your computer and use it in GitHub Desktop.
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