spec/octopolo/scripts/deployable_spec.rb in octopolo-1.5.2 vs spec/octopolo/scripts/deployable_spec.rb in octopolo-1.5.3
- old
+ new
@@ -17,11 +17,11 @@
status_checks_passed?: true) }
before do
allow(subject).to receive(:cli) { cli }
allow(subject).to receive(:config) { config }
allow(Octopolo::GitHub::PullRequest).to receive(:new) { pull_request }
- allow(PullRequestMerger).to receive(:perform) { true }
+ allow_any_instance_of(PullRequestMerger).to receive(:perform) { true }
allow(Octopolo::GitHub).to receive(:check_connection) { true }
end
context "#execute" do
after do
@@ -41,11 +41,11 @@
before do
GitHub::PullRequest.should_receive(:current) { pull_request }
end
it "takes the pull requests ID from the current branch" do
- PullRequestMerger.should_receive(:perform).with(Git::DEPLOYABLE_PREFIX, pull_request.number, :user_notifications => config.user_notifications)
+ expect_any_instance_of(PullRequestMerger).to receive(:perform)
end
end
context "without an existing PR for the current branch" do
before do
@@ -65,21 +65,21 @@
pull_request.should_receive(:add_labels)
end
context "when merge to deployable fails" do
before do
- allow(PullRequestMerger).to receive(:perform) { false }
+ allow_any_instance_of(PullRequestMerger).to receive(:perform) { false }
end
- it "removes the deployable label" do
- pull_request.should_receive(:remove_labels)
+ it "does not add any labels" do
+ pull_request.should_not_receive(:add_labels)
end
end
context "when the merge to deployable succeeds" do
- it "doesn't remove the deployable label" do
- pull_request.should_not_receive(:remove_labels)
+ it "adds a label" do
+ pull_request.should_receive(:add_labels)
end
end
context "with an invalid auth token" do
before do
@@ -132,10 +132,9 @@
it "adds the deployable label" do
pull_request.should_receive(:add_labels)
end
end
-
end
end
end
end