spec/circleci/bundle/update/pr_spec.rb in circleci-bundle-update-pr-1.14.3 vs spec/circleci/bundle/update/pr_spec.rb in circleci-bundle-update-pr-1.14.4
- old
+ new
@@ -16,6 +16,31 @@
context 'given nil' do
before { ENV['CIRCLE_REPOSITORY_URL'] = nil }
it { is_expected.to eq 'github.com' }
end
end
+
+ describe ".target_branch?" do
+ subject do
+ Circleci::Bundle::Update::Pr.send(
+ :target_branch?,
+ running_branch: running_branch,
+ target_branches: ["target"],
+ )
+ end
+
+ context "running_target is included in target branches" do
+ let(:running_branch) { 'target' }
+ it { is_expected.to be_truthy }
+ end
+
+ context "ENV['CIRCLE_BRANCH'] is not included in target branches" do
+ let(:running_branch) { 'not_included' }
+ it { is_expected.to be_falsy }
+ end
+
+ context "ENV['CIRCLE_BRANCH'] is nil" do
+ let(:running_branch) { nil }
+ it { is_expected.to be_falsy }
+ end
+ end
end