diff --git a/spec/unit/generator/generator_tags_spec.rb b/spec/unit/generator/generator_tags_spec.rb index ebcd866..5e6b442 100644 --- a/spec/unit/generator/generator_tags_spec.rb +++ b/spec/unit/generator/generator_tags_spec.rb @@ -1,21 +1,21 @@ describe GitHubChangelogGenerator::Generator do describe "#get_filtered_tags" do - before(:all) do - @generator = GitHubChangelogGenerator::Generator.new - end - context "when between_tags nil" do + before do + @generator = GitHubChangelogGenerator::Generator.new(between_tags: nil) + end + subject do - @generator.instance_variable_set("@options", between_tags: nil) @generator.get_filtered_tags(%w(1 2 3)) end it { is_expected.to be_a(Array) } it { is_expected.to match_array(%w(1 2 3)) } end - context "when between_tags same as input array" do + before do + @generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3)) + end subject do - @generator.instance_variable_set("@options", between_tags: %w(1 2 3)) @generator.get_filtered_tags(%w(1 2 3)) end it { is_expected.to be_a(Array) } @@ -23,16 +23,22 @@ describe GitHubChangelogGenerator::Generator do end context "when between_tags filled with correct values" do + before do + @generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2)) + end subject do - @generator.instance_variable_set("@options", between_tags: %w(1 2)) @generator.get_filtered_tags(%w(1 2 3)) end it { is_expected.to be_a(Array) } it { is_expected.to match_array(%w(1 2)) } end + context "when between_tags filled with invalid values" do + before do + @generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 q w)) + end + subject do - @generator.instance_variable_set("@options", between_tags: %w(1 q w)) @generator.get_filtered_tags(%w(1 2 3)) end it { is_expected.to be_a(Array) }