Commit 9773ccc4519c4c35f969248c4e0f13689b631760

Authored by Dmitriy Zaporozhets
1 parent 71bd9568

sidekiq with green tests

1 web: bundle exec rails s -p $PORT 1 web: bundle exec rails s -p $PORT
2 -worker: bundle exec rake sidekiq:start 2 +worker: bundle exec sidekiq -q post_receive,mailer,system_hook,common,default
config/initializers/4_resque.rb
@@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
1 -# Custom Redis configuration  
2 -config_file = Rails.root.join('config', 'resque.yml')  
3 -  
4 -resque_url = if File.exists?(config_file)  
5 - YAML.load_file(config_file)[Rails.env]  
6 - else  
7 - "localhost:6379"  
8 - end  
9 -  
10 -Sidekiq.configure_server do |config|  
11 - config.redis = {  
12 - url: "redis://#{resque_url}",  
13 - namespace: 'resque:gitlab'  
14 - }  
15 -end  
16 -  
17 -Sidekiq.configure_client do |config|  
18 - config.redis = {  
19 - url: "redis://#{resque_url}",  
20 - namespace: 'resque:gitlab'  
21 - }  
22 -end  
config/initializers/4_sidekiq.rb 0 → 100644
@@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
  1 +# Custom Redis configuration
  2 +config_file = Rails.root.join('config', 'resque.yml')
  3 +
  4 +resque_url = if File.exists?(config_file)
  5 + YAML.load_file(config_file)[Rails.env]
  6 + else
  7 + "localhost:6379"
  8 + end
  9 +
  10 +Sidekiq.configure_server do |config|
  11 + config.redis = {
  12 + url: "redis://#{resque_url}",
  13 + namespace: 'resque:gitlab'
  14 + }
  15 +end
  16 +
  17 +Sidekiq.configure_client do |config|
  18 + config.redis = {
  19 + url: "redis://#{resque_url}",
  20 + namespace: 'resque:gitlab'
  21 + }
  22 +end
features/steps/admin/admin_active_tab.rb
@@ -28,6 +28,6 @@ class AdminActiveTab < Spinach::FeatureSteps @@ -28,6 +28,6 @@ class AdminActiveTab < Spinach::FeatureSteps
28 end 28 end
29 29
30 Then 'the active main tab should be Resque' do 30 Then 'the active main tab should be Resque' do
31 - ensure_active_main_tab('Resque') 31 + ensure_active_main_tab('Background Jobs')
32 end 32 end
33 end 33 end
features/support/env.rb
@@ -6,6 +6,8 @@ require './config/environment' @@ -6,6 +6,8 @@ require './config/environment'
6 require 'rspec' 6 require 'rspec'
7 require 'database_cleaner' 7 require 'database_cleaner'
8 require 'spinach/capybara' 8 require 'spinach/capybara'
  9 +require 'sidekiq/testing/inline'
  10 +
9 11
10 %w(gitolite_stub stubbed_repository valid_commit).each do |f| 12 %w(gitolite_stub stubbed_repository valid_commit).each do |f|
11 require Rails.root.join('spec', 'support', f) 13 require Rails.root.join('spec', 'support', f)
lib/hooks/post-receive
1 #!/usr/bin/env bash 1 #!/usr/bin/env bash
2 2
  3 +# Version 4.1
3 # This file was placed here by GitLab. It makes sure that your pushed commits 4 # This file was placed here by GitLab. It makes sure that your pushed commits
4 # will be processed properly. 5 # will be processed properly.
5 6
lib/tasks/gitlab/check.rake
@@ -871,7 +871,7 @@ namespace :gitlab do @@ -871,7 +871,7 @@ namespace :gitlab do
871 871
872 872
873 namespace :resque do 873 namespace :resque do
874 - desc "GITLAB | Check the configuration of Resque" 874 + desc "GITLAB | Check the configuration of Sidekiq"
875 task check: :environment do 875 task check: :environment do
876 warn_user_is_not_gitlab 876 warn_user_is_not_gitlab
877 start_checking "Resque" 877 start_checking "Resque"
@@ -888,7 +888,7 @@ namespace :gitlab do @@ -888,7 +888,7 @@ namespace :gitlab do
888 def check_resque_running 888 def check_resque_running
889 print "Running? ... " 889 print "Running? ... "
890 890
891 - if run_and_match("ps aux | grep -i resque", /resque-[\d\.]+:.+$/) 891 + if run_and_match("ps aux | grep -i sidekiq", /sidekiq-[\d\.]+:.+$/)
892 puts "yes".green 892 puts "yes".green
893 else 893 else
894 puts "no".red 894 puts "no".red
@@ -899,7 +899,7 @@ namespace :gitlab do @@ -899,7 +899,7 @@ namespace :gitlab do
899 ) 899 )
900 for_more_information( 900 for_more_information(
901 see_installation_guide_section("Install Init Script"), 901 see_installation_guide_section("Install Init Script"),
902 - "see log/resque.log for possible errors" 902 + "see log/sidekiq.log for possible errors"
903 ) 903 )
904 fix_and_rerun 904 fix_and_rerun
905 end 905 end
spec/models/system_hook_spec.rb
@@ -23,41 +23,31 @@ describe SystemHook do @@ -23,41 +23,31 @@ describe SystemHook do
23 end 23 end
24 24
25 it "project_create hook" do 25 it "project_create hook" do
26 - with_resque do  
27 - project = create(:project)  
28 - end 26 + project = create(:project)
29 WebMock.should have_requested(:post, @system_hook.url).with(body: /project_create/).once 27 WebMock.should have_requested(:post, @system_hook.url).with(body: /project_create/).once
30 end 28 end
31 29
32 it "project_destroy hook" do 30 it "project_destroy hook" do
33 project = create(:project) 31 project = create(:project)
34 - with_resque do  
35 - project.destroy  
36 - end 32 + project.destroy
37 WebMock.should have_requested(:post, @system_hook.url).with(body: /project_destroy/).once 33 WebMock.should have_requested(:post, @system_hook.url).with(body: /project_destroy/).once
38 end 34 end
39 35
40 it "user_create hook" do 36 it "user_create hook" do
41 - with_resque do  
42 - create(:user)  
43 - end 37 + create(:user)
44 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_create/).once 38 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_create/).once
45 end 39 end
46 40
47 it "user_destroy hook" do 41 it "user_destroy hook" do
48 user = create(:user) 42 user = create(:user)
49 - with_resque do  
50 - user.destroy  
51 - end 43 + user.destroy
52 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_destroy/).once 44 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_destroy/).once
53 end 45 end
54 46
55 it "project_create hook" do 47 it "project_create hook" do
56 user = create(:user) 48 user = create(:user)
57 project = create(:project) 49 project = create(:project)
58 - with_resque do  
59 - project.team << [user, :master]  
60 - end 50 + project.team << [user, :master]
61 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_add_to_team/).once 51 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_add_to_team/).once
62 end 52 end
63 53
@@ -65,11 +55,8 @@ describe SystemHook do @@ -65,11 +55,8 @@ describe SystemHook do
65 user = create(:user) 55 user = create(:user)
66 project = create(:project) 56 project = create(:project)
67 project.team << [user, :master] 57 project.team << [user, :master]
68 - with_resque do  
69 - project.users_projects.clear  
70 - end 58 + project.users_projects.clear
71 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_remove_from_team/).once 59 WebMock.should have_requested(:post, @system_hook.url).with(body: /user_remove_from_team/).once
72 end 60 end
73 end 61 end
74 -  
75 end 62 end
spec/observers/issue_observer_spec.rb
@@ -21,8 +21,7 @@ describe IssueObserver do @@ -21,8 +21,7 @@ describe IssueObserver do
21 end 21 end
22 22
23 it 'sends an email to the assignee' do 23 it 'sends an email to the assignee' do
24 - Notify.should_receive(:new_issue_email).with(issue.id).  
25 - and_return(double(deliver: true)) 24 + Notify.should_receive(:new_issue_email).with(issue.id)
26 25
27 subject.after_create(issue) 26 subject.after_create(issue)
28 end 27 end
@@ -71,6 +70,7 @@ describe IssueObserver do @@ -71,6 +70,7 @@ describe IssueObserver do
71 context 'a status "closed"' do 70 context 'a status "closed"' do
72 it 'note is created if the issue is being closed' do 71 it 'note is created if the issue is being closed' do
73 issue.should_receive(:is_being_closed?).and_return(true) 72 issue.should_receive(:is_being_closed?).and_return(true)
  73 + Notify.should_receive(:issue_status_changed_email).twice
74 Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed') 74 Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed')
75 75
76 subject.after_update(issue) 76 subject.after_update(issue)
@@ -85,7 +85,7 @@ describe IssueObserver do @@ -85,7 +85,7 @@ describe IssueObserver do
85 85
86 it 'notification is delivered if the issue being closed' do 86 it 'notification is delivered if the issue being closed' do
87 issue.stub(:is_being_closed?).and_return(true) 87 issue.stub(:is_being_closed?).and_return(true)
88 - Notify.should_receive(:issue_status_changed_email).twice.and_return(stub(deliver: true)) 88 + Notify.should_receive(:issue_status_changed_email).twice
89 Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed') 89 Note.should_receive(:create_status_change_note).with(issue, some_user, 'closed')
90 90
91 subject.after_update(issue) 91 subject.after_update(issue)
@@ -104,7 +104,7 @@ describe IssueObserver do @@ -104,7 +104,7 @@ describe IssueObserver do
104 issue_without_assignee.stub(:is_being_reassigned?).and_return(false) 104 issue_without_assignee.stub(:is_being_reassigned?).and_return(false)
105 issue_without_assignee.stub(:is_being_closed?).and_return(true) 105 issue_without_assignee.stub(:is_being_closed?).and_return(true)
106 issue_without_assignee.stub(:is_being_reopened?).and_return(false) 106 issue_without_assignee.stub(:is_being_reopened?).and_return(false)
107 - Notify.should_receive(:issue_status_changed_email).once.and_return(stub(deliver: true)) 107 + Notify.should_receive(:issue_status_changed_email).once
108 Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'closed') 108 Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'closed')
109 109
110 subject.after_update(issue_without_assignee) 110 subject.after_update(issue_without_assignee)
@@ -113,6 +113,7 @@ describe IssueObserver do @@ -113,6 +113,7 @@ describe IssueObserver do
113 113
114 context 'a status "reopened"' do 114 context 'a status "reopened"' do
115 it 'note is created if the issue is being reopened' do 115 it 'note is created if the issue is being reopened' do
  116 + Notify.should_receive(:issue_status_changed_email).twice
116 issue.should_receive(:is_being_reopened?).and_return(true) 117 issue.should_receive(:is_being_reopened?).and_return(true)
117 Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened') 118 Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened')
118 119
@@ -128,7 +129,7 @@ describe IssueObserver do @@ -128,7 +129,7 @@ describe IssueObserver do
128 129
129 it 'notification is delivered if the issue being reopened' do 130 it 'notification is delivered if the issue being reopened' do
130 issue.stub(:is_being_reopened?).and_return(true) 131 issue.stub(:is_being_reopened?).and_return(true)
131 - Notify.should_receive(:issue_status_changed_email).twice.and_return(stub(deliver: true)) 132 + Notify.should_receive(:issue_status_changed_email).twice
132 Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened') 133 Note.should_receive(:create_status_change_note).with(issue, some_user, 'reopened')
133 134
134 subject.after_update(issue) 135 subject.after_update(issue)
@@ -147,7 +148,7 @@ describe IssueObserver do @@ -147,7 +148,7 @@ describe IssueObserver do
147 issue_without_assignee.stub(:is_being_reassigned?).and_return(false) 148 issue_without_assignee.stub(:is_being_reassigned?).and_return(false)
148 issue_without_assignee.stub(:is_being_closed?).and_return(false) 149 issue_without_assignee.stub(:is_being_closed?).and_return(false)
149 issue_without_assignee.stub(:is_being_reopened?).and_return(true) 150 issue_without_assignee.stub(:is_being_reopened?).and_return(true)
150 - Notify.should_receive(:issue_status_changed_email).once.and_return(stub(deliver: true)) 151 + Notify.should_receive(:issue_status_changed_email).once
151 Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'reopened') 152 Note.should_receive(:create_status_change_note).with(issue_without_assignee, some_user, 'reopened')
152 153
153 subject.after_update(issue_without_assignee) 154 subject.after_update(issue_without_assignee)
@@ -164,8 +165,7 @@ describe IssueObserver do @@ -164,8 +165,7 @@ describe IssueObserver do
164 end 165 end
165 166
166 def it_sends_a_reassigned_email_to(recipient) 167 def it_sends_a_reassigned_email_to(recipient)
167 - Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id).  
168 - and_return(double(deliver: true)) 168 + Notify.should_receive(:reassigned_issue_email).with(recipient, issue.id, previous_assignee.id)
169 end 169 end
170 170
171 def it_does_not_send_a_reassigned_email_to(recipient) 171 def it_does_not_send_a_reassigned_email_to(recipient)
spec/observers/merge_request_observer_spec.rb
@@ -21,9 +21,7 @@ describe MergeRequestObserver do @@ -21,9 +21,7 @@ describe MergeRequestObserver do
21 end 21 end
22 22
23 it 'sends an email to the assignee' do 23 it 'sends an email to the assignee' do
24 - Notify.should_receive(:new_merge_request_email).with(mr.id).  
25 - and_return(double(deliver: true))  
26 - 24 + Notify.should_receive(:new_merge_request_email).with(mr.id)
27 subject.after_create(mr) 25 subject.after_create(mr)
28 end 26 end
29 27
@@ -158,8 +156,7 @@ describe MergeRequestObserver do @@ -158,8 +156,7 @@ describe MergeRequestObserver do
158 end 156 end
159 157
160 def it_sends_a_reassigned_email_to(recipient) 158 def it_sends_a_reassigned_email_to(recipient)
161 - Notify.should_receive(:reassigned_merge_request_email).with(recipient, mr.id, previous_assignee.id).  
162 - and_return(double(deliver: true)) 159 + Notify.should_receive(:reassigned_merge_request_email).with(recipient, mr.id, previous_assignee.id)
163 end 160 end
164 161
165 def it_does_not_send_a_reassigned_email_to(recipient) 162 def it_does_not_send_a_reassigned_email_to(recipient)
spec/observers/note_observer_spec.rb
@@ -4,7 +4,6 @@ describe NoteObserver do @@ -4,7 +4,6 @@ describe NoteObserver do
4 subject { NoteObserver.instance } 4 subject { NoteObserver.instance }
5 5
6 let(:team_without_author) { (1..2).map { |n| double :user, id: n } } 6 let(:team_without_author) { (1..2).map { |n| double :user, id: n } }
7 - let(:delivery_success) { double deliver: true }  
8 7
9 describe '#after_create' do 8 describe '#after_create' do
10 let(:note) { double :note } 9 let(:note) { double :note }
@@ -45,13 +44,13 @@ describe NoteObserver do @@ -45,13 +44,13 @@ describe NoteObserver do
45 note.stub(:id).and_return(42) 44 note.stub(:id).and_return(42)
46 author = double :user, id: 1 45 author = double :user, id: 1
47 note.stub(:commit_author).and_return(author) 46 note.stub(:commit_author).and_return(author)
48 - Notify.should_receive(:note_commit_email).and_return(delivery_success) 47 + Notify.should_receive(:note_commit_email)
49 48
50 subject.after_create(note) 49 subject.after_create(note)
51 end 50 end
52 51
53 it 'does not notify the author of a commit when not flagged to notify the author' do 52 it 'does not notify the author of a commit when not flagged to notify the author' do
54 - Notify.should_not_receive(:note_commit_email) 53 + notify.should_not_receive(:note_commit_email)
55 54
56 subject.after_create(note) 55 subject.after_create(note)
57 end 56 end
@@ -71,28 +70,28 @@ describe NoteObserver do @@ -71,28 +70,28 @@ describe NoteObserver do
71 context 'notifies team of a new note on' do 70 context 'notifies team of a new note on' do
72 it 'a commit' do 71 it 'a commit' do
73 note.stub(:noteable_type).and_return('Commit') 72 note.stub(:noteable_type).and_return('Commit')
74 - Notify.should_receive(:note_commit_email).twice.and_return(delivery_success) 73 + notify.should_receive(:note_commit_email).twice
75 74
76 subject.send(:notify_team, note) 75 subject.send(:notify_team, note)
77 end 76 end
78 77
79 it 'an issue' do 78 it 'an issue' do
80 note.stub(:noteable_type).and_return('Issue') 79 note.stub(:noteable_type).and_return('Issue')
81 - Notify.should_receive(:note_issue_email).twice.and_return(delivery_success) 80 + notify.should_receive(:note_issue_email).twice
82 81
83 subject.send(:notify_team, note) 82 subject.send(:notify_team, note)
84 end 83 end
85 84
86 it 'a wiki page' do 85 it 'a wiki page' do
87 note.stub(:noteable_type).and_return('Wiki') 86 note.stub(:noteable_type).and_return('Wiki')
88 - Notify.should_receive(:note_wiki_email).twice.and_return(delivery_success) 87 + notify.should_receive(:note_wiki_email).twice
89 88
90 subject.send(:notify_team, note) 89 subject.send(:notify_team, note)
91 end 90 end
92 91
93 it 'a merge request' do 92 it 'a merge request' do
94 note.stub(:noteable_type).and_return('MergeRequest') 93 note.stub(:noteable_type).and_return('MergeRequest')
95 - Notify.should_receive(:note_merge_request_email).twice.and_return(delivery_success) 94 + notify.should_receive(:note_merge_request_email).twice
96 95
97 subject.send(:notify_team, note) 96 subject.send(:notify_team, note)
98 end 97 end
@@ -100,16 +99,16 @@ describe NoteObserver do @@ -100,16 +99,16 @@ describe NoteObserver do
100 it 'a wall' do 99 it 'a wall' do
101 # Note: wall posts have #noteable_type of nil 100 # Note: wall posts have #noteable_type of nil
102 note.stub(:noteable_type).and_return(nil) 101 note.stub(:noteable_type).and_return(nil)
103 - Notify.should_receive(:note_wall_email).twice.and_return(delivery_success) 102 + notify.should_receive(:note_wall_email).twice
104 103
105 subject.send(:notify_team, note) 104 subject.send(:notify_team, note)
106 end 105 end
107 end 106 end
108 107
109 it 'does nothing for a new note on a snippet' do 108 it 'does nothing for a new note on a snippet' do
110 - note.stub(:noteable_type).and_return('Snippet') 109 + note.stub(:noteable_type).and_return('Snippet')
111 110
112 - subject.send(:notify_team, note).should be_nil 111 + subject.send(:notify_team, note).should be_nil
113 end 112 end
114 end 113 end
115 114
@@ -125,4 +124,8 @@ describe NoteObserver do @@ -125,4 +124,8 @@ describe NoteObserver do
125 subject.send(:team_without_note_author, note).should == team_without_author 124 subject.send(:team_without_note_author, note).should == team_without_author
126 end 125 end
127 end 126 end
  127 +
  128 + def notify
  129 + Notify
  130 + end
128 end 131 end
spec/observers/user_observer_spec.rb
@@ -10,24 +10,14 @@ describe UserObserver do @@ -10,24 +10,14 @@ describe UserObserver do
10 end 10 end
11 11
12 context 'when a new user is created' do 12 context 'when a new user is created' do
13 - let(:user) { double(:user, id: 42,  
14 - password: 'P@ssword!',  
15 - name: 'John',  
16 - email: 'u@mail.local',  
17 - username: 'root',  
18 - create_namespace: true) }  
19 - let(:notification) { double :notification }  
20 -  
21 it 'sends an email' do 13 it 'sends an email' do
22 - notification.should_receive(:deliver)  
23 - Notify.should_receive(:new_user_email).with(user.id, user.password).and_return(notification)  
24 -  
25 - subject.after_create(user) 14 + Notify.should_receive(:new_user_email)
  15 + create(:user)
26 end 16 end
27 17
28 it 'trigger logger' do 18 it 'trigger logger' do
29 Gitlab::AppLogger.should_receive(:info) 19 Gitlab::AppLogger.should_receive(:info)
30 - subject.after_create(user) 20 + create(:user)
31 end 21 end
32 end 22 end
33 end 23 end
spec/requests/admin/admin_users_spec.rb
@@ -41,7 +41,7 @@ describe &quot;Admin::Users&quot; do @@ -41,7 +41,7 @@ describe &quot;Admin::Users&quot; do
41 end 41 end
42 42
43 it "should call send mail" do 43 it "should call send mail" do
44 - Notify.should_receive(:new_user_email).and_return(stub(deliver: true)) 44 + Notify.should_receive(:new_user_email)
45 45
46 User.observers.enable :user_observer do 46 User.observers.enable :user_observer do
47 click_button "Save" 47 click_button "Save"
@@ -50,9 +50,7 @@ describe &quot;Admin::Users&quot; do @@ -50,9 +50,7 @@ describe &quot;Admin::Users&quot; do
50 50
51 it "should send valid email to user with email & password" do 51 it "should send valid email to user with email & password" do
52 User.observers.enable :user_observer do 52 User.observers.enable :user_observer do
53 - with_resque do  
54 - click_button "Save"  
55 - end 53 + click_button "Save"
56 user = User.last 54 user = User.last
57 email = ActionMailer::Base.deliveries.last 55 email = ActionMailer::Base.deliveries.last
58 email.subject.should have_content("Account was created") 56 email.subject.should have_content("Account was created")
spec/spec_helper.rb
1 require 'simplecov' unless ENV['CI'] 1 require 'simplecov' unless ENV['CI']
2 2
  3 +
3 # This file is copied to spec/ when you run 'rails generate rspec:install' 4 # This file is copied to spec/ when you run 'rails generate rspec:install'
4 ENV["RAILS_ENV"] ||= 'test' 5 ENV["RAILS_ENV"] ||= 'test'
5 require File.expand_path("../../config/environment", __FILE__) 6 require File.expand_path("../../config/environment", __FILE__)
@@ -8,6 +9,7 @@ require &#39;capybara/rails&#39; @@ -8,6 +9,7 @@ require &#39;capybara/rails&#39;
8 require 'capybara/rspec' 9 require 'capybara/rspec'
9 require 'webmock/rspec' 10 require 'webmock/rspec'
10 require 'email_spec' 11 require 'email_spec'
  12 +require 'sidekiq/testing/inline'
11 13
12 # Requires supporting ruby files with custom matchers and macros, etc, 14 # Requires supporting ruby files with custom matchers and macros, etc,
13 # in spec/support/ and its subdirectories. 15 # in spec/support/ and its subdirectories.
spec/workers/post_receive_spec.rb
@@ -4,7 +4,7 @@ describe PostReceive do @@ -4,7 +4,7 @@ describe PostReceive do
4 4
5 context "as a resque worker" do 5 context "as a resque worker" do
6 it "reponds to #perform" do 6 it "reponds to #perform" do
7 - PostReceive.should respond_to(:perform) 7 + PostReceive.new.should respond_to(:perform)
8 end 8 end
9 end 9 end
10 10
@@ -15,7 +15,7 @@ describe PostReceive do @@ -15,7 +15,7 @@ describe PostReceive do
15 15
16 it "fetches the correct project" do 16 it "fetches the correct project" do
17 Project.should_receive(:find_with_namespace).with(project.path_with_namespace).and_return(project) 17 Project.should_receive(:find_with_namespace).with(project.path_with_namespace).and_return(project)
18 - PostReceive.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) 18 + PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id)
19 end 19 end
20 20
21 it "does not run if the author is not in the project" do 21 it "does not run if the author is not in the project" do
@@ -24,7 +24,7 @@ describe PostReceive do @@ -24,7 +24,7 @@ describe PostReceive do
24 project.should_not_receive(:observe_push) 24 project.should_not_receive(:observe_push)
25 project.should_not_receive(:execute_hooks) 25 project.should_not_receive(:execute_hooks)
26 26
27 - PostReceive.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false 27 + PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id).should be_false
28 end 28 end
29 29
30 it "asks the project to trigger all hooks" do 30 it "asks the project to trigger all hooks" do
@@ -34,7 +34,7 @@ describe PostReceive do @@ -34,7 +34,7 @@ describe PostReceive do
34 project.should_receive(:update_merge_requests) 34 project.should_receive(:update_merge_requests)
35 project.should_receive(:observe_push) 35 project.should_receive(:observe_push)
36 36
37 - PostReceive.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id) 37 + PostReceive.new.perform(pwd(project), 'sha-old', 'sha-new', 'refs/heads/master', key_id)
38 end 38 end
39 end 39 end
40 40