spec/gitscrub/level_spec.rb in gitscrub-0.0.2 vs spec/gitscrub/level_spec.rb in gitscrub-0.0.3
- old
+ new
@@ -15,13 +15,19 @@
@level = Gitscrub::Level.load(1)
end
it "should load the level" do
File.stub(:dirname).and_return("")
+ File.stub(:exists?).and_return(true)
File.should_receive(:read).with('/../../levels/1.rb').and_return(@file)
level = Gitscrub::Level.load(1)
level.ldifficulty.should eql(1)
level.ldescription.should eql("A test description")
+ end
+
+ it "should return false if the level does not exist" do
+ File.stub(:exists?).and_return(false)
+ Gitscrub::Level.load(1).should eql(false)
end
it "should solve the problem" do
@level.solve.should eql(false)
end