Sha256: 75be2e206fd0e4ada41a6eafd0fc726bc613f8845a8201ac7a613faa3ce1da6e
Contents?: true
Size: 1.74 KB
Versions: 1
Compression:
Stored size: 1.74 KB
Contents
require File.dirname(__FILE__) + '/../../spec_helper.rb' module PDF class Writer def save_as(path) #no op end end end describe PDF::Storycards::Writer do before(:all) do @single_story_path = File.dirname(__FILE__) + '/../../addition' @single_story_with_meta_data_path = File.dirname(__FILE__) + '/../../subtraction_with_metadata' @multiple_stories_with_meta_data_path = File.dirname(__FILE__) + '/../../calculator_stories_with_metadata' end it "should parse an example plain text story file and create a new story" do story_text = File.read(@single_story_path) stories = PDF::Storycards::StoryParser.new.parse_stories(story_text) stories.first.title.should == 'simple addition' stories.first.narrative.should == "As an accountant\nI want to add numbers\nSo that I can count beans" end it "should parse extract metadata from plain text story file and set it on the story" do story_text = File.read(@single_story_with_meta_data_path) stories = PDF::Storycards::StoryParser.new.parse_stories(story_text) stories.first.meta_data['CardNumber'].should == '152' stories.first.meta_data['Estimate'].should == 'Medium' end it "should treat a single . on a line as a separator between story groups" do story_text = File.read(@multiple_stories_with_meta_data_path) stories = PDF::Storycards::StoryParser.new.parse_stories(story_text) stories.first.title.should == 'simple multiplication' stories.first.meta_data['CardNumber'].should == '12' stories.first.meta_data['Estimate'].should == 'Very Easy' stories.last.title.should == 'simple subtraction' stories.last.meta_data['CardNumber'].should == '15' stories.last.meta_data['Estimate'].should == 'Very Hard' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pdf-storycards-0.1.0 | spec/pdf/storycards/story_parser_spec.rb |