From c8c633a65d0663161a1980cedea070d2a305b49f Mon Sep 17 00:00:00 2001 From: Petr Korolev Date: Mon, 25 May 2015 15:43:59 +0300 Subject: [PATCH] add tests for second arg --- spec/unit/parser_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/spec/unit/parser_spec.rb b/spec/unit/parser_spec.rb index 6f80a6e..607344d 100644 --- a/spec/unit/parser_spec.rb +++ b/spec/unit/parser_spec.rb @@ -41,5 +41,20 @@ describe GitHubChangelogGenerator::Parser do it { is_expected.to be_a(Array) } it { is_expected.to match_array([nil, nil]) } end + context "when site is nil" do + subject { GitHubChangelogGenerator::Parser.user_project_from_option("skywinder/ActionSheetPicker-3.0", nil, nil) } + it { is_expected.to be_a(Array) } + it { is_expected.to match_array(["skywinder", "ActionSheetPicker-3.0"]) } + end + context "when site is valid" do + subject { GitHubChangelogGenerator::Parser.user_project_from_option("skywinder/ActionSheetPicker-3.0", nil, "https://codeclimate.com") } + it { is_expected.to be_a(Array) } + it { is_expected.to match_array(["skywinder", "ActionSheetPicker-3.0"]) } + end + context "when second arg is not nil" do + subject { GitHubChangelogGenerator::Parser.user_project_from_option("skywinder/ActionSheetPicker-3.0", "blah", nil) } + it { is_expected.to be_a(Array) } + it { is_expected.to match_array([nil, nil]) } + end end end