Sha256: c4610df049ba4c63dc1d294451d4a21e00d706c2bd2629bb0ced8b40b71ae4b5
Contents?: true
Size: 1.17 KB
Versions: 1
Compression:
Stored size: 1.17 KB
Contents
require './spec/spec_helper' require 'fileutils' describe DayOne::Entry do after :all do Dir['spec/entries/*.doentry'].each{ |f| FileUtils.rm(f) } FileUtils.rmdir('spec/entries') end describe "#to_xml" do it "should give a default entry" do e = subject.to_xml e.should match %r|<key>Entry Text</key>\s*<string></string>| e.should match %r|<key>Starred</key>\s*<false/>| end it "should set from initialize" do e = DayOne::Entry.new 'foo', starred:true e.starred.should be_true e.entry_text.should == 'foo' end it "should act properly when starred" do e = DayOne::Entry.new('foo', starred:true).to_xml e.should match %r|<key>Starred</key>\s*<true/>| end end describe "#create!" do it "should correctly create a .doentry file" do DayOne::journal_location = 'spec' FileUtils::mkdir_p 'spec/entries' e = subject e.entry_text = "Hello, world!" e.create! file_location = Dir['spec/entries/*.doentry'][0] file_location.should_not be_nil contents = File.read(file_location) contents.should == e.to_xml end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rb-dayone-0.2.0 | spec/entry_spec.rb |