From c110c9bd7f2fabb5c9397291f1f13c6accab70e6 Mon Sep 17 00:00:00 2001
From: James Lopez <james@jameslopez.es>
Date: Wed, 17 Feb 2016 18:29:43 +0100
Subject: [PATCH] refactored spec

---
 spec/services/git_push_service_spec.rb | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index 48e796b6946..994585fb32c 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -14,10 +14,17 @@ describe GitPushService, services: true do
   end
 
   describe 'Push branches' do
+
+    let(:oldrev) { @oldrev }
+    let(:newrev) { @newrev }
+
+    subject do
+      execute_service(project, user, oldrev, newrev, @ref )
+    end
+
     context 'new branch' do
-      subject do
-        execute_service(project, user, @blankrev, @newrev, @ref )
-      end
+
+      let(:oldrev) { @blankrev }
 
       it { is_expected.to be_truthy }
 
@@ -35,9 +42,6 @@ describe GitPushService, services: true do
     end
 
     context 'existing branch' do
-      subject do
-        execute_service(project, user, @oldrev, @newrev, @ref )
-      end
 
       it { is_expected.to be_truthy }
 
@@ -49,9 +53,8 @@ describe GitPushService, services: true do
     end
 
     context 'rm branch' do
-      subject do
-        execute_service(project, user, @oldrev, @blankrev, @ref )
-      end
+
+      let(:newrev) { @blankrev }
 
       it { is_expected.to be_truthy }
 
-- 
GitLab