Commits

soycamo committed f3a4fe0

moved tapestry_spec to kamishibai_spec

  • Participants
  • Parent commits 4c6ca65

Comments (0)

Files changed (4)

File lib/kamishibai.rb

 
   def initialize(gamefile_path)
     gamefile = File.open(gamefile_path, 'r')
+    raise "Can't load gamefile" unless gamefile
+
     @slideset = []
     current_slide = nil
     gamefile.each do |line|

File spec/kamishibai_spec.rb

+require 'rspec'
+require './lib/kamishibai'
+require 'pp'
+
+describe Kamishibai do
+
+  before do
+    @ksb = Kamishibai.new("./example_gamefile.txt")
+  end
+
+  it "in a typical situation, should create correct number of slides" do
+    @ksb.slideset.length.should == 4
+  end
+
+  it "should clean attributes" do
+    slide = @ksb.slideset.first
+    clean_attributes = 
+      {"image" => "Conclusion.bmp",
+       "music" => "shota(Rally the troops).mid",
+       "description" => "Conclusion. Here you just basically touch things up and prepare the story for its final form to be published (read by others), so this is what you need to remember...",
+       "option3" => "--->",
+       "link3" => "A19",
+       "option4" => "<---",
+       "link4" => "A17"}
+
+    Kamishibai.parse_attributes!(slide)
+    slide.attributes.should == clean_attributes
+  end
+
+  it "should return the correct number of attributes" do
+    slide = @ksb.slideset.first
+    slide.attributes.length.should == 7
+  end
+
+  it "should format a slide in Twee format" do
+    twee_output = <<-TW
+:: A18
+Conclusion. Here you just basically touch things up and prepare the story for its final form to be published (read by others), so this is what you need to remember...
+
+
+TW
+    slide = @ksb.slideset.first
+    slide.to_twee.should == twee_output 
+  end
+end
 
 # Not sure if I want to handle file, directory or *gulp*
 # A WINDOWS EXECUTABLE PACKAGE. i cry e'ery nite
+
 gamefile = ARGV[0] 
 Kamishibai.new(gamefile).export

File tapestry_spec.rb

-require 'rspec'
-require './tapestry'
-require 'pp'
-
-describe Kamishibai do
-
-  before do
-    @ksb = Kamishibai.new("./example_gamefile.txt")
-  end
-
-  it "in a typical situation, should create correct number of slides" do
-    @ksb.slideset.length.should == 4
-  end
-
-  it "should clean attributes" do
-    slide = @ksb.slideset.first
-    clean_attributes = 
-      {"image" => "Conclusion.bmp",
-       "music" => "shota(Rally the troops).mid",
-       "description" => "Conclusion. Here you just basically touch things up and prepare the story for its final form to be published (read by others), so this is what you need to remember...",
-       "option3" => "--->",
-       "link3" => "A19",
-       "option4" => "<---",
-       "link4" => "A17"}
-
-    Kamishibai.parse_attributes!(slide)
-    slide.attributes.should == clean_attributes
-  end
-
-  it "should return the correct number of attributes" do
-    slide = @ksb.slideset.first
-    slide.attributes.length.should == 7
-  end
-
-  it "should format a slide in Twee format" do
-    twee_output = <<-TW
-:: A18
-Conclusion. Here you just basically touch things up and prepare the story for its final form to be published (read by others), so this is what you need to remember...
-TW
-    slide = @ksb.slideset.first
-    slide.to_twee.should == twee_output 
-  end
-end