Sha256: 5a1174dc7935c44e648f66d07584dc3aa4f5a7311889947dbc766c439807bda4
Contents?: true
Size: 819 Bytes
Versions: 1
Compression:
Stored size: 819 Bytes
Contents
require 'writer' describe Writer do let(:file) do File.open('2012-01Jan-03.md') end before :each do Date.stub(:today) do Date.new(2012, 1, 3) end end after :all do File.delete('2012-01Jan-03.md') File.delete('.template') File.delete('My custom filename.txt') end it "creates today's file, blank" do Writer.write! file.read.should == "\n" end it "creates the file with your custom name" do filename = "My custom filename.txt" Writer.write!(filename) File.open(filename) end it "uses a template, if it exists" do body = "hello\nworld" File.open('.template', 'w') do |f| f.puts body end Writer.configure do |c| c.template_path = '.template' end Writer.write! file.read.should == body + "\n" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
writer-0.0.1 | spec/writer_spec.rb |