Sha256: a0419181f58721b48a8dd00260726912923d4779f490a459c3a099a9c5534e45
Contents?: true
Size: 1.56 KB
Versions: 4
Compression:
Stored size: 1.56 KB
Contents
require 'spec_helper' describe Gitscrub::Game do before(:each) do @profile = mock Gitscrub::Profile.stub(:new).and_return(@profile) @game = Gitscrub::Game.new @profile.stub(:level).and_return(1) @profile.stub(:save) @level = mock @level.stub(:full_description) @level.stub(:setup_level) Gitscrub::UI.stub(:puts) Gitscrub::Level.stub(:load).and_return(@level) end it "should have a profile" do @game.profile.should eql(@profile) end it "should show a description if the level is 0" do @level.should_not_receive(:solve) @profile.stub(:level).and_return(0) @profile.should_receive(:save) Gitscrub::UI.should_receive(:puts).with("Welcome to Gitscrub") @profile.should_receive(:level=).with(1) @game.play_level end it "should echo congratulations if the level is solved" do @level.stub(:solve).and_return(true) @profile.should_receive(:level=).with(2) Gitscrub::UI.should_receive(:success).with("Congratulations, you have solved the level") @game.play_level end it "should echo congratulations if the level is solved" do @level.stub(:solve).and_return(false) Gitscrub::UI.should_receive(:error).with("Sorry, this solution is not quite right!") @game.play_level end it "should output the description of the next level" do @level.should_receive(:full_description) @profile.stub(:level=) @game.level_bump end it "should call setup_level for the next level" do @level.should_receive(:setup_level) @profile.stub(:level=) @game.level_bump end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
gitscrub-0.0.8 | spec/gitscrub/game_spec.rb |
gitscrub-0.0.7 | spec/gitscrub/game_spec.rb |
gitscrub-0.0.6 | spec/gitscrub/game_spec.rb |
gitscrub-0.0.5 | spec/gitscrub/game_spec.rb |