Generator#exclude_issues_by_labels spec clearer
This commit is contained in:
parent
87b9962a8d
commit
89d1b5393d
|
@ -1,15 +1,27 @@
|
||||||
module GitHubChangelogGenerator
|
module GitHubChangelogGenerator
|
||||||
describe Generator do
|
describe Generator do
|
||||||
context "#exclude_issues_by_labels" do
|
context "#exclude_issues_by_labels" do
|
||||||
let(:label) { double("the-bad-label", name: "BAD") }
|
let(:label) { double("the-bad-label", name: "BAD") }
|
||||||
let(:issue) { double("the-issue-to-be-excluded", labels: [label]) }
|
let(:issue) { double("the-issue-to-be-excluded", labels: [label]) }
|
||||||
let(:issues) { [issue] }
|
let(:good_label) { double("a-good-label", name: "GOOD") }
|
||||||
|
let(:good_issue) { double("an-issue-to-be-kept", labels: [good_label]) }
|
||||||
|
let(:issues) { [issue, good_issue] }
|
||||||
subject(:generator) { described_class.new(exclude_labels: %w(BAD BOO))}
|
subject(:generator) { described_class.new(exclude_labels: %w(BAD BOO))}
|
||||||
|
|
||||||
it "removes issues with labels in the exclude_label list" do
|
it "removes issues with labels in the exclude_label list" do
|
||||||
result = generator.exclude_issues_by_labels(issues)
|
result = generator.exclude_issues_by_labels(issues)
|
||||||
|
|
||||||
expect(result).to be_empty
|
expect(result).to include(good_issue)
|
||||||
|
expect(result).not_to include(issue)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with no option given" do
|
||||||
|
subject(:generator) { described_class.new }
|
||||||
|
it "passes everything through when no option given" do
|
||||||
|
result = generator.exclude_issues_by_labels(issues)
|
||||||
|
|
||||||
|
expect(result).to eq(issues)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user