From 068af037f5e9ade5db91aa6371165369ee3ff673 Mon Sep 17 00:00:00 2001 From: Olle Jonsson Date: Sat, 19 Mar 2016 16:54:13 +0100 Subject: [PATCH] Spec: use RSpec contexts --- spec/unit/parse_file_spec.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/unit/parse_file_spec.rb b/spec/unit/parse_file_spec.rb index 65ff5a2..0af43cc 100644 --- a/spec/unit/parse_file_spec.rb +++ b/spec/unit/parse_file_spec.rb @@ -1,14 +1,14 @@ describe GitHubChangelogGenerator::ParserFile 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) } subject { parser.parse! } it { is_expected.to be_nil } end context "when file is empty" do - let(:options) { {} } let(:parser) { GitHubChangelogGenerator::ParserFile.new(options, StringIO.new("")) } it "does not change the options" do @@ -17,7 +17,6 @@ describe GitHubChangelogGenerator::ParserFile do end context "when file is incorrect" do - let(:options) { {} } let(:options_before_change) { options.dup } let(:file) { StringIO.new("unreleased_label=staging\nunreleased: false") } let(:parser) do @@ -29,7 +28,7 @@ describe GitHubChangelogGenerator::ParserFile 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(:parser) do - GitHubChangelogGenerator::ParserFile.new({}, file) + GitHubChangelogGenerator::ParserFile.new(options, file) end it { expect { parser.parse! }.not_to raise_error } end