This commit is contained in:
Petr Korolev 2015-05-26 14:56:49 +03:00
parent 7e941990c4
commit f498e673d1
2 changed files with 20 additions and 10 deletions

View File

@ -5,9 +5,15 @@ describe GitHubChangelogGenerator::Generator do
end end
context "when between_tags nil" do context "when between_tags nil" do
# before(:each) do subject do
# @generator.options = {} @generator.instance_variable_set("@options", between_tags: nil)
# end @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
subject do subject do
@generator.instance_variable_set("@options", between_tags: %w(1 2 3)) @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))
@ -16,11 +22,7 @@ describe GitHubChangelogGenerator::Generator do
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 1" do context "when between_tags filled with correct values" do
# before(:each) do
# @generator.options = {between_tags: ["1"]}
# end
subject do subject do
@generator.instance_variable_set("@options", between_tags: %w(1 2)) @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))
@ -28,5 +30,13 @@ describe GitHubChangelogGenerator::Generator do
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
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) }
it { is_expected.to match_array(%w(1)) }
end
end end
end end

View File

@ -1,5 +1,5 @@
describe GitHubChangelogGenerator::Parser do describe GitHubChangelogGenerator::Parser do
describe "#self.user_project_from_remote" do describe ".user_project_from_remote" do
context "when remote is 1" do context "when remote is 1" do
subject { GitHubChangelogGenerator::Parser.user_project_from_remote("origin https://github.com/skywinder/ActionSheetPicker-3.0 (fetch)") } subject { GitHubChangelogGenerator::Parser.user_project_from_remote("origin https://github.com/skywinder/ActionSheetPicker-3.0 (fetch)") }
it { is_expected.to be_a(Array) } it { is_expected.to be_a(Array) }
@ -26,7 +26,7 @@ describe GitHubChangelogGenerator::Parser do
it { is_expected.to match_array([nil, nil]) } it { is_expected.to match_array([nil, nil]) }
end end
end end
describe "#self.user_project_from_option" do describe ".user_project_from_option" do
# context "when option is invalid" do # context "when option is invalid" do
# it("should exit") { expect { GitHubChangelogGenerator::Parser.user_project_from_option("blah", nil) }.to raise_error(SystemExit) } # it("should exit") { expect { GitHubChangelogGenerator::Parser.user_project_from_option("blah", nil) }.to raise_error(SystemExit) }
# end # end