Spec: use RSpec contexts
This commit is contained in:
parent
4569fad479
commit
068af037f5
|
@ -1,14 +1,14 @@
|
||||||
describe GitHubChangelogGenerator::ParserFile do
|
describe GitHubChangelogGenerator::ParserFile do
|
||||||
describe ".github_changelog_generator" do
|
describe ".github_changelog_generator" do
|
||||||
context "when no has file" do
|
|
||||||
let(:options) { {} }
|
let(:options) { {} }
|
||||||
|
|
||||||
|
context "when the well-known default file does not exist" do
|
||||||
let(:parser) { GitHubChangelogGenerator::ParserFile.new(options) }
|
let(:parser) { GitHubChangelogGenerator::ParserFile.new(options) }
|
||||||
subject { parser.parse! }
|
subject { parser.parse! }
|
||||||
it { is_expected.to be_nil }
|
it { is_expected.to be_nil }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when file is empty" do
|
context "when file is empty" do
|
||||||
let(:options) { {} }
|
|
||||||
let(:parser) { GitHubChangelogGenerator::ParserFile.new(options, StringIO.new("")) }
|
let(:parser) { GitHubChangelogGenerator::ParserFile.new(options, StringIO.new("")) }
|
||||||
|
|
||||||
it "does not change the options" do
|
it "does not change the options" do
|
||||||
|
@ -17,7 +17,6 @@ describe GitHubChangelogGenerator::ParserFile do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when file is incorrect" do
|
context "when file is incorrect" do
|
||||||
let(:options) { {} }
|
|
||||||
let(:options_before_change) { options.dup }
|
let(:options_before_change) { options.dup }
|
||||||
let(:file) { StringIO.new("unreleased_label=staging\nunreleased: false") }
|
let(:file) { StringIO.new("unreleased_label=staging\nunreleased: false") }
|
||||||
let(:parser) do
|
let(:parser) do
|
||||||
|
@ -29,7 +28,7 @@ describe GitHubChangelogGenerator::ParserFile do
|
||||||
context "allows comments with semi-colon or pound sign" do
|
context "allows comments with semi-colon or pound sign" do
|
||||||
let(:file) { StringIO.new("# Comment on first line\nunreleased_label=staging\n; Comment on third line\nunreleased=false") }
|
let(:file) { StringIO.new("# Comment on first line\nunreleased_label=staging\n; Comment on third line\nunreleased=false") }
|
||||||
let(:parser) do
|
let(:parser) do
|
||||||
GitHubChangelogGenerator::ParserFile.new({}, file)
|
GitHubChangelogGenerator::ParserFile.new(options, file)
|
||||||
end
|
end
|
||||||
it { expect { parser.parse! }.not_to raise_error }
|
it { expect { parser.parse! }.not_to raise_error }
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user