Permalink
Browse files

Define robot. Add robot_spec

  • Loading branch information...
SelenaSmall committed Aug 26, 2017
1 parent 8a6b7df commit b52bc1d8e4fd3081ffb19214552732df3b74f3e0
Showing with 29 additions and 2 deletions.
  1. +8 −0 lib/robot.rb
  2. +13 −0 spec/robot_spec.rb
  3. +8 −2 toy_robot.rb
@@ -0,0 +1,8 @@
# Robot Class
class Robot
attr_reader :position
def intialize
@position = nil
end
end
@@ -0,0 +1,13 @@
require 'rspec'
require 'spec_helper'
require './lib/robot'
describe Robot do
describe '#initialize' do
it 'should have a current_position attribute which is nil' do
instance = Robot.new
expect(instance.position).to be_nil
end
end
end
@@ -1,12 +1,18 @@
#!/usr/bin/ruby
require_relative './lib/table'
require_relative './lib/robot'
# Initialize Table objects
@table = Table.new
table = Table.new
robot = Robot.new
# Is this a valid position on the table
puts @table.valid_position?(1, 0)
puts table.valid_position?(1, 0)
# Ensure the robot's position is nil
puts 'Robot position is nil' if robot.position.nil?
# Keep reading user inputs while the program is running
loop do

0 comments on commit b52bc1d

Please sign in to comment.