Sha256: f5db852e7b8b5c614332e9d7345c021dc94a4d5d1376ed76b9a451b99dd27f71
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
require 'game_class' module StudioGame describe Game do before do @game = Game.new("Knuckleheads") @ih = 100 # literally my only mistake lmao @player = Player.new("moe", @ih) @game.add_player(@player) end it "w00t for high die roll" do Die.any_instance.stub(:roll).and_return(5) @game.play(2) @player.health.should == @ih + (15 * 2) end it "skip for mid die roll" do Die.any_instance.stub(:roll).and_return(3) @game.play(2) @player.health.should == @ih end it "blams for low die roll" do Die.any_instance.stub(:roll).and_return(1) @game.play(2) @player.health.should == (@ih - 10 * 2) end it "assigns a treasure for points during a player's turn" do game = Game.new("Knuckleheads") player = Player.new("moe") game.add_player(player) game.play(1) player.points.should_not be_zero # or use alternate expectation syntax: # expect(player.points).not_to be_zero end it "computes total points as the sum of all player points" do game = Game.new("Knuckleheads") player1 = Player.new("moe") player2 = Player.new("larry") game.add_player(player1) game.add_player(player2) player1.found_treasure(Treasure.new(:hammer, 50)) player1.found_treasure(Treasure.new(:hammer, 50)) player2.found_treasure(Treasure.new(:crowbar, 400)) game.total_points.should == 500 end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
j_studio_game-1.0.2 | spec/game_spec.rb |
j_studio_game-1.0.1 | spec/game_spec.rb |