Skip to content

Instantly share code, notes, and snippets.

@RyanSnodgrass
Created April 9, 2014 13:32
Show Gist options
  • Select an option

  • Save RyanSnodgrass/10270919 to your computer and use it in GitHub Desktop.

Select an option

Save RyanSnodgrass/10270919 to your computer and use it in GitHub Desktop.
require 'rspec'
require './horserace.rb'
describe Horse do
let(:horse) {Horse.new}
it 'should exist' do
horse.should_not eq(nil)
end
it 'should create user horse' do
user_horse = Horse.new(true)
user_horse.stub(:gets).and_return("tripod")
user_horse.get_name.should eq("tripod")
end
it 'should do bot run' do
horse.bot_run.should_not eq(nil)
end
end
describe Game do
let(:play) {Game.new}
it 'should print graphic' do
play.horse_graphic.should_not be_empty
end
context 'define track appearance' do
it 'should print bot tracks' do
play.matz_track.should_not be_empty
end
it 'should print bot tracks' do
play.user_track[1].should_not be_empty
end
end
it 'should get commands' do
play.play_game.initializer.stub(:gets).and_return("")
play.play_game.intitializer.should eq("")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment