diff --git a/lib/github_changelog_generator/generator/generator_tags.rb b/lib/github_changelog_generator/generator/generator_tags.rb index d8f4534ab..7568a1790 100644 --- a/lib/github_changelog_generator/generator/generator_tags.rb +++ b/lib/github_changelog_generator/generator/generator_tags.rb @@ -135,7 +135,7 @@ def filter_since_tag(all_tags) [] end else - Helper.log.warn "Warning: can't find tag #{tag}, specified with --since-tag option." + raise ChangelogGeneratorError, "Error: can't find tag #{tag}, specified with --since-tag option." end end filtered_tags @@ -155,7 +155,7 @@ def filter_due_tag(all_tags) [] end else - Helper.log.warn "Warning: can't find tag #{tag}, specified with --due-tag option." + raise ChangelogGeneratorError, "Error: can't find tag #{tag}, specified with --due-tag option." end end filtered_tags diff --git a/spec/unit/generator/generator_tags_spec.rb b/spec/unit/generator/generator_tags_spec.rb index d9dc6b46c..515da2302 100644 --- a/spec/unit/generator/generator_tags_spec.rb +++ b/spec/unit/generator/generator_tags_spec.rb @@ -191,24 +191,16 @@ def tags_from_strings(tags_strings) context "with invalid since tag" do let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "Invalid tag") } - it { is_expected.to be_a Array } - it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) } + it { expect { subject }.to raise_error(GitHubChangelogGenerator::ChangelogGeneratorError) } end end context "with empty array" do subject { generator.filter_since_tag(tags_from_strings(%w[])) } - context "with valid since tag" do - let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "2") } - it { is_expected.to be_a Array } - it { is_expected.to match_array(tags_from_strings(%w[])) } - end - context "with invalid since tag" do let(:generator) { GitHubChangelogGenerator::Generator.new(since_tag: "Invalid tag") } - it { is_expected.to be_a Array } - it { is_expected.to match_array(tags_from_strings(%w[])) } + it { expect { subject }.to raise_error(GitHubChangelogGenerator::ChangelogGeneratorError) } end end end @@ -225,24 +217,16 @@ def tags_from_strings(tags_strings) context "with invalid due tag" do let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "Invalid tag") } - it { is_expected.to be_a Array } - it { is_expected.to match_array(tags_from_strings(%w[1 2 3])) } + it { expect { subject }.to raise_error(GitHubChangelogGenerator::ChangelogGeneratorError) } end end context "with empty array" do subject { generator.filter_due_tag(tags_from_strings(%w[])) } - context "with valid due tag" do - let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "2") } - it { is_expected.to be_a Array } - it { is_expected.to match_array(tags_from_strings(%w[])) } - end - context "with invalid due tag" do let(:generator) { GitHubChangelogGenerator::Generator.new(due_tag: "Invalid tag") } - it { is_expected.to be_a Array } - it { is_expected.to match_array(tags_from_strings(%w[])) } + it { expect { subject }.to raise_error(GitHubChangelogGenerator::ChangelogGeneratorError) } end end end