Skip to content

Commit

Permalink
Update tests to work for ruby 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
djds23 committed Mar 15, 2016
1 parent 842bec8 commit 553dbbb
Showing 1 changed file with 15 additions and 22 deletions.
37 changes: 15 additions & 22 deletions spec/file_info_spec.rb
Original file line number Diff line number Diff line change
@@ -1,44 +1,37 @@
RSpec.describe(Jekyll::Compose::FileInfo) do
let(:open_and_closing_tag) { "---\n" }
let(:layout_content) { "post\n" }

describe '#content' do
context 'with a title of only words' do
let(:expected_result) {<<-CONTENT.gsub(/^\s+/, '')
---
layout: post
title: A test arg parser
---
CONTENT
}

let(:parsed_args) { Jekyll::Compose::ArgParser.new(
let(:expected_title) { "A test arg parser\n" }
subject { described_class.new Jekyll::Compose::ArgParser.new(
['A test arg parser'],
{}
)
}

it 'does not wrap the title in quotes' do
file_info = described_class.new parsed_args
expect(file_info.content).to eq(expected_result)
expect(subject.content).to start_with(open_and_closing_tag)
expect(subject.content).to end_with(open_and_closing_tag)
expect(subject.content).to match(layout_content)
expect(subject.content).to match(expected_title)
end
end

context 'with a title that includes a colon' do
let(:expected_result) {<<-CONTENT.gsub(/^\s+/, '')
---
layout: post
title: 'A test: arg parser'
---
CONTENT
}

let(:parsed_args) { Jekyll::Compose::ArgParser.new(
let(:expected_title) { "'A test: arg parser'\n" }
subject { described_class.new Jekyll::Compose::ArgParser.new(
['A test: arg parser'],
{}
)
}

it 'does wrap the title in quotes' do
file_info = described_class.new parsed_args
expect(file_info.content).to eq(expected_result)
expect(subject.content).to start_with(open_and_closing_tag)
expect(subject.content).to end_with(open_and_closing_tag)
expect(subject.content).to match(layout_content)
expect(subject.content).to match(expected_title)
end
end
end
Expand Down

0 comments on commit 553dbbb

Please sign in to comment.