2015-09-15 18:38:41 +00:00
|
|
|
describe GitHubChangelogGenerator::ParserFile do
|
|
|
|
describe ".github_changelog_generator" do
|
|
|
|
context "when no has file" do
|
|
|
|
let(:options) { {} }
|
|
|
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
|
|
|
subject { parse.parse! }
|
|
|
|
it { is_expected.to be_nil }
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when file is empty" do
|
|
|
|
let(:options) { { params_file: "spec/files/github_changelog_params_empty" } }
|
|
|
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
2015-09-22 19:45:16 +00:00
|
|
|
|
|
|
|
it "does not change the options" do
|
|
|
|
expect { parse.parse! }.to_not change { options }
|
|
|
|
end
|
2015-09-15 18:38:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context "when file is incorrect" do
|
|
|
|
let(:options) { { params_file: "spec/files/github_changelog_params_incorrect" } }
|
2015-09-22 19:45:16 +00:00
|
|
|
let(:options_before_change) { options.dup }
|
2015-09-15 18:38:41 +00:00
|
|
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
2015-09-22 19:45:16 +00:00
|
|
|
it { expect { parse.parse! }.to raise_error }
|
2015-09-15 18:38:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
context "when override default values" do
|
2015-10-21 22:09:25 +00:00
|
|
|
let(:default_options) { GitHubChangelogGenerator::Parser.default_options }
|
2015-09-22 19:45:16 +00:00
|
|
|
let(:options) { { params_file: "spec/files/github_changelog_params_override" }.merge(default_options) }
|
|
|
|
let(:options_before_change) { options.dup }
|
2015-09-15 18:38:41 +00:00
|
|
|
let(:parse) { GitHubChangelogGenerator::ParserFile.new(options) }
|
2015-09-22 19:45:16 +00:00
|
|
|
|
|
|
|
it "changes the options" do
|
|
|
|
expect { parse.parse! }.to change { options }
|
|
|
|
.from(options_before_change)
|
|
|
|
.to(options_before_change.merge(unreleased_label: "staging",
|
|
|
|
unreleased: false,
|
|
|
|
header: "=== Changelog ==="))
|
|
|
|
end
|
2015-09-15 18:38:41 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|