This commit is contained in:
Petr Korolev 2015-05-26 15:19:24 +03:00
parent f498e673d1
commit 957fa0d3a3

View File

@ -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) }