Merge branch 'master' into develop
This commit is contained in:
commit
a0cf2f54ee
|
@ -45,11 +45,11 @@ module GitHubChangelogGenerator
|
||||||
filtered_tags = all_tags
|
filtered_tags = all_tags
|
||||||
if @options[:between_tags]
|
if @options[:between_tags]
|
||||||
@options[:between_tags].each do |tag|
|
@options[:between_tags].each do |tag|
|
||||||
unless all_tags.include? tag
|
unless all_tags.map(&:name).include? tag
|
||||||
puts "Warning: can't find tag #{tag}, specified with --between-tags option.".yellow
|
Helper.log.warn "Warning: can't find tag #{tag}, specified with --between-tags option."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
filtered_tags = all_tags.select { |tag| @options[:between_tags].include? tag }
|
filtered_tags = all_tags.select { |tag| @options[:between_tags].include? tag.name }
|
||||||
end
|
end
|
||||||
filtered_tags
|
filtered_tags
|
||||||
end
|
end
|
||||||
|
@ -58,11 +58,11 @@ module GitHubChangelogGenerator
|
||||||
filtered_tags = all_tags
|
filtered_tags = all_tags
|
||||||
if @options[:exclude_tags]
|
if @options[:exclude_tags]
|
||||||
@options[:exclude_tags].each do |tag|
|
@options[:exclude_tags].each do |tag|
|
||||||
unless all_tags.include? tag
|
unless all_tags.map(&:name).include? tag
|
||||||
puts "Warning: can't find tag #{tag}, specified with --between-tags option.".yellow
|
Helper.log.warn "Warning: can't find tag #{tag}, specified with --exclude-tags option."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
filtered_tags = all_tags.reject { |tag| @options[:exclude_tags].include? tag }
|
filtered_tags = all_tags.reject { |tag| @options[:exclude_tags].include? tag.name }
|
||||||
end
|
end
|
||||||
filtered_tags
|
filtered_tags
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,20 +6,20 @@ describe GitHubChangelogGenerator::Generator do
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
@generator.get_filtered_tags(%w(1 2 3))
|
@generator.get_filtered_tags(tags_mash_from_strings(%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(tags_mash_from_strings(%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
|
before do
|
||||||
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3))
|
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3))
|
||||||
end
|
end
|
||||||
subject do
|
subject do
|
||||||
@generator.get_filtered_tags(%w(1 2 3))
|
@generator.get_filtered_tags(tags_mash_from_strings(%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(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when between_tags filled with correct values" do
|
context "when between_tags filled with correct values" do
|
||||||
|
@ -27,10 +27,10 @@ describe GitHubChangelogGenerator::Generator do
|
||||||
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2))
|
@generator = GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2))
|
||||||
end
|
end
|
||||||
subject do
|
subject do
|
||||||
@generator.get_filtered_tags(%w(1 2 3))
|
@generator.get_filtered_tags(tags_mash_from_strings(%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(tags_mash_from_strings(%w(1 2))) }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when between_tags filled with invalid values" do
|
context "when between_tags filled with invalid values" do
|
||||||
|
@ -39,31 +39,42 @@ describe GitHubChangelogGenerator::Generator do
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
@generator.get_filtered_tags(%w(1 2 3))
|
@generator.get_filtered_tags(tags_mash_from_strings(%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)) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1))) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tags_mash_from_strings(tags_strings)
|
||||||
|
mash_array = []
|
||||||
|
tags_strings.each do |tag|
|
||||||
|
mash_tag = Hashie::Mash.new
|
||||||
|
mash_tag.name = tag
|
||||||
|
mash_array << mash_tag
|
||||||
|
end
|
||||||
|
mash_array
|
||||||
|
end
|
||||||
|
|
||||||
describe "#get_filtered_tags" do
|
describe "#get_filtered_tags" do
|
||||||
subject { generator.get_filtered_tags(%w(1 2 3 4 5)) }
|
subject do
|
||||||
# before { generator.get_filtered_tags(%w(1 2 3 4 5)) }
|
generator.get_filtered_tags(tags_mash_from_strings(%w(1 2 3 4 5)))
|
||||||
|
end
|
||||||
|
|
||||||
context "with excluded and between tags" do
|
context "with excluded and between tags" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3), exclude_tags: %w(2)) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(between_tags: %w(1 2 3), exclude_tags: %w(2)) }
|
||||||
it { is_expected.to be_a Array }
|
it { is_expected.to be_a Array }
|
||||||
it { is_expected.to match_array(%w(1 3)) }
|
it { is_expected.to match_array(tags_mash_from_strings(%w(1 3))) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#filter_excluded_tags" do
|
describe "#filter_excluded_tags" do
|
||||||
subject { generator.filter_excluded_tags(%w(1 2 3)) }
|
subject { generator.filter_excluded_tags(tags_mash_from_strings(%w(1 2 3))) }
|
||||||
|
|
||||||
context "with valid excluded tags" do
|
context "with valid excluded tags" do
|
||||||
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(3)) }
|
let(:generator) { GitHubChangelogGenerator::Generator.new(exclude_tags: %w(3)) }
|
||||||
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(tags_mash_from_strings(%w(1 2))) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user