Skip to content

Commit 553dbbb

Browse files
committed
Update tests to work for ruby 1.9
1 parent 842bec8 commit 553dbbb

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

spec/file_info_spec.rb

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,37 @@
11
RSpec.describe(Jekyll::Compose::FileInfo) do
2+
let(:open_and_closing_tag) { "---\n" }
3+
let(:layout_content) { "post\n" }
4+
25
describe '#content' do
36
context 'with a title of only words' do
4-
let(:expected_result) {<<-CONTENT.gsub(/^\s+/, '')
5-
---
6-
layout: post
7-
title: A test arg parser
8-
---
9-
CONTENT
10-
}
11-
12-
let(:parsed_args) { Jekyll::Compose::ArgParser.new(
7+
let(:expected_title) { "A test arg parser\n" }
8+
subject { described_class.new Jekyll::Compose::ArgParser.new(
139
['A test arg parser'],
1410
{}
1511
)
1612
}
1713

1814
it 'does not wrap the title in quotes' do
19-
file_info = described_class.new parsed_args
20-
expect(file_info.content).to eq(expected_result)
15+
expect(subject.content).to start_with(open_and_closing_tag)
16+
expect(subject.content).to end_with(open_and_closing_tag)
17+
expect(subject.content).to match(layout_content)
18+
expect(subject.content).to match(expected_title)
2119
end
2220
end
2321

2422
context 'with a title that includes a colon' do
25-
let(:expected_result) {<<-CONTENT.gsub(/^\s+/, '')
26-
---
27-
layout: post
28-
title: 'A test: arg parser'
29-
---
30-
CONTENT
31-
}
32-
33-
let(:parsed_args) { Jekyll::Compose::ArgParser.new(
23+
let(:expected_title) { "'A test: arg parser'\n" }
24+
subject { described_class.new Jekyll::Compose::ArgParser.new(
3425
['A test: arg parser'],
3526
{}
3627
)
3728
}
3829

3930
it 'does wrap the title in quotes' do
40-
file_info = described_class.new parsed_args
41-
expect(file_info.content).to eq(expected_result)
31+
expect(subject.content).to start_with(open_and_closing_tag)
32+
expect(subject.content).to end_with(open_and_closing_tag)
33+
expect(subject.content).to match(layout_content)
34+
expect(subject.content).to match(expected_title)
4235
end
4336
end
4437
end

0 commit comments

Comments
 (0)