Permalink
Browse files

put back tests for places accessor, move book use case failures to pi…

…votal tracker
  • Loading branch information...
1 parent 10e030f commit 15f9b5c3b6f245f1771bbefc9956165eef6ea927 @ultrasaurus ultrasaurus committed Sep 18, 2011
Showing with 24 additions and 48 deletions.
  1. +3 −2 lib/place.rb
  2. +21 −46 spec/pie_spec.rb
View
@@ -1,6 +1,7 @@
class Pie::Place
- attr_reader :name, :description, :paths
+ attr_accessor :description
+ attr_reader :name, :paths
def initialize(places, options)
@paths = {}
@@ -34,7 +35,7 @@ def extract_name_and_description(options)
def extract_standard_options(options)
end
-
+
def name=(name)
valid = false
begin
View
@@ -189,7 +189,7 @@ def get_binding
end
end
- it "raises an error when place doesn't exist" do
+ it "raises an error when non-existant place speficied in path" do
lambda {
@game.instance_eval do
field.path xxx:north
@@ -199,49 +199,24 @@ def get_binding
end
end
- # describe "can access places" do
- # before do
- # ship description:"ookina fune"
- # building description:"ookina biru"
- # tower description:"ookina towa"
- # end
- #
- # it "which are accessible by named key (symbol)" do
- # ship = $pie.places[:ship]
- # ship.should_not be_nil
- # ship[:description].should == "ookina fune"
- # end
- #
- # it "which are accessible by named key (string)" do
- # ship = $pie.places["ship"]
- # ship.should_not be_nil
- # ship[:description].should == "ookina fune"
- # end
- #
- # it "resulting in 2 places" do
- # $pie.places.length.should == 3
- # end
- #
- # it "and can find place after named place" do
- # building = $pie.places.after(:ship)
- # building.should_not be_nil
- # building[:description].should == "ookina biru"
- # end
- #
- # it "and finds nil after last place" do
- # nothing = $pie.places.after(:tower)
- # nothing.should be_nil
- # end
- #
- # it "and can find place before named place" do
- # building = $pie.places.before(:tower)
- # building.should_not be_nil
- # building[:description].should == "ookina biru"
- # end
- #
- # it "and finds nil before first place" do
- # nothing = $pie.places.before(:ship)
- # nothing.should be_nil
- # end
- # end
+ describe "can access places" do
+ before do
+ @game.instance_eval do
+ place ship:"ookina fune"
+ place building:"ookina biru"
+ place tower:"ookina towa"
+ end
+ end
+
+ it "which are accessible by named key (symbol)" do
+ ship = @game.places[:ship]
+ ship.should_not be_nil
+ ship.description.should == "ookina fune"
+ end
+
+ it "resulting in 2 places" do
+ @game.places.length.should == 3
+ end
+
+ end
end

0 comments on commit 15f9b5c

Please sign in to comment.