Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
toshimaru committed May 10, 2016
1 parent 162249a commit 005b2af
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/post_spec.rb
Expand Up @@ -5,6 +5,7 @@
let(:datestamp) { Time.now.strftime('%Y-%m-%d') }
let(:filename) { "#{datestamp}-a-test-post.md" }
let(:path) { posts_dir.join(filename) }
let(:jekyll_config) { YAML.load_file('../fixtures/_config.yml') }

before(:all) do
FileUtils.mkdir_p source_dir unless File.directory? source_dir
Expand Down Expand Up @@ -44,6 +45,13 @@
expect(File.read(path)).to match(/layout: other-layout/)
end

it 'creates a new page with the specified config' do
expect(Jekyll).to receive(:configuration).and_return(jekyll_config)
capture_stdout { described_class.process(args) }
expect(File.read(path)).to match(/description: my description/)
expect(File.read(path)).to match(/category: /)
end

it 'should write a helpful message when successful' do
output = capture_stdout { described_class.process(args) }
expect(output).to eql("New post created at _posts/#{filename}.\n")
Expand Down

0 comments on commit 005b2af

Please sign in to comment.