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 GitHubChangelogGenerator::Generator do
describe "#get_filtered_tags" do describe "#get_filtered_tags" do
before(:all) do context "when between_tags nil" do
@generator = GitHubChangelogGenerator::Generator.new before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: nil)
end end
context "when between_tags nil" do
subject do subject do
@generator.instance_variable_set("@options", between_tags: nil)
@generator.get_filtered_tags(%w(1 2 3)) @generator.get_filtered_tags(%w(1 2 3))
end end
it { is_expected.to be_a(Array) } it { is_expected.to be_a(Array) }
it { is_expected.to match_array(%w(1 2 3)) } it { is_expected.to match_array(%w(1 2 3)) }
end end
context "when between_tags same as input array" do context "when between_tags same as input array" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3))
end
subject do subject do
@generator.instance_variable_set("@options", between_tags: %w(1 2 3))
@generator.get_filtered_tags(%w(1 2 3)) @generator.get_filtered_tags(%w(1 2 3))
end end
it { is_expected.to be_a(Array) } it { is_expected.to be_a(Array) }
@ -23,16 +23,22 @@ describe GitHubChangelogGenerator::Generator do
end end
context "when between_tags filled with correct values" do context "when between_tags filled with correct values" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2))
end
subject do subject do
@generator.instance_variable_set("@options", between_tags: %w(1 2))
@generator.get_filtered_tags(%w(1 2 3)) @generator.get_filtered_tags(%w(1 2 3))
end end
it { is_expected.to be_a(Array) } it { is_expected.to be_a(Array) }
it { is_expected.to match_array(%w(1 2)) } it { is_expected.to match_array(%w(1 2)) }
end end
context "when between_tags filled with invalid values" do context "when between_tags filled with invalid values" do
before do
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 q w))
end
subject do subject do
@generator.instance_variable_set("@options", between_tags: %w(1 q w))
@generator.get_filtered_tags(%w(1 2 3)) @generator.get_filtered_tags(%w(1 2 3))
end end
it { is_expected.to be_a(Array) } it { is_expected.to be_a(Array) }