Commit d46dba58302a2e4aa55991f88b302dd6c15539dd

Authored by Dmitriy Zaporozhets
2 parents 4227f6ed d8952783

Merge pull request #5847 from skv-headless/fix_deprecation_warnings

fix most of warnings
app/controllers/admin/projects_controller.rb
@@ -7,7 +7,7 @@ class Admin::ProjectsController < Admin::ApplicationController @@ -7,7 +7,7 @@ class Admin::ProjectsController < Admin::ApplicationController
7 owner_id = params[:owner_id] 7 owner_id = params[:owner_id]
8 user = User.find_by_id(owner_id) 8 user = User.find_by_id(owner_id)
9 9
10 - @projects = user ? user.owned_projects : Project.scoped 10 + @projects = user ? user.owned_projects : Project.all
11 @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? 11 @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present?
12 @projects = @projects.with_push if params[:with_push].present? 12 @projects = @projects.with_push if params[:with_push].present?
13 @projects = @projects.abandoned if params[:abandoned].present? 13 @projects = @projects.abandoned if params[:abandoned].present?
app/controllers/admin/users_controller.rb
@@ -2,8 +2,7 @@ class Admin::UsersController < Admin::ApplicationController @@ -2,8 +2,7 @@ class Admin::UsersController < Admin::ApplicationController
2 before_filter :user, only: [:show, :edit, :update, :destroy] 2 before_filter :user, only: [:show, :edit, :update, :destroy]
3 3
4 def index 4 def index
5 - @users = User.scoped  
6 - @users = @users.filter(params[:filter]) 5 + @users = User.filter(params[:filter])
7 @users = @users.search(params[:name]) if params[:name].present? 6 @users = @users.search(params[:name]) if params[:name].present?
8 @users = @users.alphabetically.page(params[:page]) 7 @users = @users.alphabetically.page(params[:page])
9 end 8 end
app/controllers/profiles/keys_controller.rb
@@ -2,7 +2,7 @@ class Profiles::KeysController < ApplicationController @@ -2,7 +2,7 @@ class Profiles::KeysController < ApplicationController
2 layout "profile" 2 layout "profile"
3 3
4 def index 4 def index
5 - @keys = current_user.keys.order('id DESC').all 5 + @keys = current_user.keys.order('id DESC')
6 end 6 end
7 7
8 def show 8 def show
app/controllers/projects/deploy_keys_controller.rb
@@ -7,7 +7,7 @@ class Projects::DeployKeysController < Projects::ApplicationController @@ -7,7 +7,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
7 layout "project_settings" 7 layout "project_settings"
8 8
9 def index 9 def index
10 - @enabled_keys = @project.deploy_keys.all 10 + @enabled_keys = @project.deploy_keys
11 @available_keys = available_keys - @enabled_keys 11 @available_keys = available_keys - @enabled_keys
12 end 12 end
13 13
app/controllers/projects/hooks_controller.rb
@@ -7,7 +7,7 @@ class Projects::HooksController < Projects::ApplicationController @@ -7,7 +7,7 @@ class Projects::HooksController < Projects::ApplicationController
7 layout "project_settings" 7 layout "project_settings"
8 8
9 def index 9 def index
10 - @hooks = @project.hooks.all 10 + @hooks = @project.hooks
11 @hook = ProjectHook.new 11 @hook = ProjectHook.new
12 end 12 end
13 13
@@ -18,7 +18,7 @@ class Projects::HooksController < Projects::ApplicationController @@ -18,7 +18,7 @@ class Projects::HooksController < Projects::ApplicationController
18 if @hook.valid? 18 if @hook.valid?
19 redirect_to project_hooks_path(@project) 19 redirect_to project_hooks_path(@project)
20 else 20 else
21 - @hooks = @project.hooks.all 21 + @hooks = @project.hooks
22 render :index 22 render :index
23 end 23 end
24 end 24 end
app/models/project.rb
@@ -322,14 +322,14 @@ class Project < ActiveRecord::Base @@ -322,14 +322,14 @@ class Project < ActiveRecord::Base
322 c_ids = self.repository.commits_between(oldrev, newrev).map(&:id) 322 c_ids = self.repository.commits_between(oldrev, newrev).map(&:id)
323 323
324 # Update code for merge requests into project between project branches 324 # Update code for merge requests into project between project branches
325 - mrs = self.merge_requests.opened.by_branch(branch_name).all 325 + mrs = self.merge_requests.opened.by_branch(branch_name).to_a
326 # Update code for merge requests between project and project fork 326 # Update code for merge requests between project and project fork
327 - mrs += self.fork_merge_requests.opened.by_branch(branch_name).all 327 + mrs += self.fork_merge_requests.opened.by_branch(branch_name).to_a
328 328
329 mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } 329 mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
330 330
331 # Close merge requests 331 # Close merge requests
332 - mrs = self.merge_requests.opened.where(target_branch: branch_name).all 332 + mrs = self.merge_requests.opened.where(target_branch: branch_name).to_a
333 mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) } 333 mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
334 mrs.each { |merge_request| merge_request.merge!(user.id) } 334 mrs.each { |merge_request| merge_request.merge!(user.id) }
335 335
app/models/project_team.rb
@@ -87,8 +87,8 @@ class ProjectTeam @@ -87,8 +87,8 @@ class ProjectTeam
87 def import(source_project) 87 def import(source_project)
88 target_project = project 88 target_project = project
89 89
90 - source_team = source_project.users_projects.all  
91 - target_team = target_project.users_projects.all 90 + source_team = source_project.users_projects.to_a
  91 + target_team = target_project.users_projects.to_a
92 target_user_ids = target_team.map(&:user_id) 92 target_user_ids = target_team.map(&:user_id)
93 93
94 source_team.reject! do |tm| 94 source_team.reject! do |tm|
app/models/user.rb
@@ -163,7 +163,7 @@ class User < ActiveRecord::Base @@ -163,7 +163,7 @@ class User < ActiveRecord::Base
163 scope :alphabetically, -> { order('name ASC') } 163 scope :alphabetically, -> { order('name ASC') }
164 scope :in_team, ->(team){ where(id: team.member_ids) } 164 scope :in_team, ->(team){ where(id: team.member_ids) }
165 scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) } 165 scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) }
166 - scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : scoped } 166 + scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all }
167 scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') } 167 scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') }
168 scope :ldap, -> { where(provider: 'ldap') } 168 scope :ldap, -> { where(provider: 'ldap') }
169 169
app/views/projects/issues/_form.html.haml
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 = f.label :milestone_id do 29 = f.label :milestone_id do
30 %i.icon-time 30 %i.icon-time
31 Milestone 31 Milestone
32 - .controls= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) 32 + .controls= f.select(:milestone_id, @project.milestones.active.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
33 33
34 .ui-box-bottom 34 .ui-box-bottom
35 .control-group 35 .control-group
app/views/projects/merge_requests/_form.html.haml
@@ -44,7 +44,7 @@ @@ -44,7 +44,7 @@
44 = f.label :milestone_id do 44 = f.label :milestone_id do
45 %i.icon-time 45 %i.icon-time
46 Milestone 46 Milestone
47 - .controls= f.select(:milestone_id, @project.milestones.active.all.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) 47 + .controls= f.select(:milestone_id, @project.milestones.active.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
48 .control-group 48 .control-group
49 = f.label :description, "Description" 49 = f.label :description, "Description"
50 .controls 50 .controls
lib/api/namespaces.rb
@@ -12,7 +12,7 @@ module API @@ -12,7 +12,7 @@ module API
12 # Example Request: 12 # Example Request:
13 # GET /namespaces 13 # GET /namespaces
14 get do 14 get do
15 - @namespaces = Namespace.scoped 15 + @namespaces = Namespace.all
16 @namespaces = @namespaces.search(params[:search]) if params[:search].present? 16 @namespaces = @namespaces.search(params[:search]) if params[:search].present?
17 @namespaces = paginate @namespaces 17 @namespaces = paginate @namespaces
18 18
lib/api/users.rb
@@ -9,7 +9,7 @@ module API @@ -9,7 +9,7 @@ module API
9 # Example Request: 9 # Example Request:
10 # GET /users 10 # GET /users
11 get do 11 get do
12 - @users = User.scoped 12 + @users = User.all
13 @users = @users.active if params[:active].present? 13 @users = @users.active if params[:active].present?
14 @users = @users.search(params[:search]) if params[:search].present? 14 @users = @users.search(params[:search]) if params[:search].present?
15 @users = paginate @users 15 @users = paginate @users
spec/contexts/fork_context_spec.rb
@@ -48,7 +48,7 @@ describe Projects::ForkContext do @@ -48,7 +48,7 @@ describe Projects::ForkContext do
48 48
49 def fork_project(from_project, user, fork_success = true) 49 def fork_project(from_project, user, fork_success = true)
50 context = Projects::ForkContext.new(from_project, user) 50 context = Projects::ForkContext.new(from_project, user)
51 - shell = mock("gitlab_shell") 51 + shell = double("gitlab_shell")
52 shell.stub(fork_repository: fork_success) 52 shell.stub(fork_repository: fork_success)
53 context.stub(gitlab_shell: shell) 53 context.stub(gitlab_shell: shell)
54 context.execute 54 context.execute
spec/controllers/application_controller_spec.rb
@@ -8,7 +8,7 @@ describe ApplicationController do @@ -8,7 +8,7 @@ describe ApplicationController do
8 it 'should redirect if the user is over their password expiry' do 8 it 'should redirect if the user is over their password expiry' do
9 user.password_expires_at = Time.new(2002) 9 user.password_expires_at = Time.new(2002)
10 user.ldap_user?.should be_false 10 user.ldap_user?.should be_false
11 - controller.stub!(:current_user).and_return(user) 11 + controller.stub(:current_user).and_return(user)
12 controller.should_receive(:redirect_to) 12 controller.should_receive(:redirect_to)
13 controller.should_receive(:new_profile_password_path) 13 controller.should_receive(:new_profile_password_path)
14 controller.send(:check_password_expiration) 14 controller.send(:check_password_expiration)
@@ -17,15 +17,15 @@ describe ApplicationController do @@ -17,15 +17,15 @@ describe ApplicationController do
17 it 'should not redirect if the user is under their password expiry' do 17 it 'should not redirect if the user is under their password expiry' do
18 user.password_expires_at = Time.now + 20010101 18 user.password_expires_at = Time.now + 20010101
19 user.ldap_user?.should be_false 19 user.ldap_user?.should be_false
20 - controller.stub!(:current_user).and_return(user) 20 + controller.stub(:current_user).and_return(user)
21 controller.should_not_receive(:redirect_to) 21 controller.should_not_receive(:redirect_to)
22 controller.send(:check_password_expiration) 22 controller.send(:check_password_expiration)
23 end 23 end
24 24
25 it 'should not redirect if the user is over their password expiry but they are an ldap user' do 25 it 'should not redirect if the user is over their password expiry but they are an ldap user' do
26 user.password_expires_at = Time.new(2002) 26 user.password_expires_at = Time.new(2002)
27 - user.stub!(:ldap_user?).and_return(true)  
28 - controller.stub!(:current_user).and_return(user) 27 + user.stub(:ldap_user?).and_return(true)
  28 + controller.stub(:current_user).and_return(user)
29 controller.should_not_receive(:redirect_to) 29 controller.should_not_receive(:redirect_to)
30 controller.send(:check_password_expiration) 30 controller.send(:check_password_expiration)
31 end 31 end
spec/helpers/application_helper_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper' @@ -3,7 +3,7 @@ require 'spec_helper'
3 describe ApplicationHelper do 3 describe ApplicationHelper do
4 describe 'current_controller?' do 4 describe 'current_controller?' do
5 before do 5 before do
6 - controller.stub!(:controller_name).and_return('foo') 6 + controller.stub(:controller_name).and_return('foo')
7 end 7 end
8 8
9 it "returns true when controller matches argument" do 9 it "returns true when controller matches argument" do
@@ -22,7 +22,7 @@ describe ApplicationHelper do @@ -22,7 +22,7 @@ describe ApplicationHelper do
22 22
23 describe 'current_action?' do 23 describe 'current_action?' do
24 before do 24 before do
25 - stub!(:action_name).and_return('foo') 25 + allow(self).to receive(:action_name).and_return('foo')
26 end 26 end
27 27
28 it "returns true when action matches argument" do 28 it "returns true when action matches argument" do
@@ -52,7 +52,7 @@ describe ApplicationHelper do @@ -52,7 +52,7 @@ describe ApplicationHelper do
52 it "should call gravatar_icon when no avatar is present" do 52 it "should call gravatar_icon when no avatar is present" do
53 user = create(:user) 53 user = create(:user)
54 user.save! 54 user.save!
55 - stub!(:gravatar_icon).and_return('gravatar_method_called') 55 + allow(self).to receive(:gravatar_icon).and_return('gravatar_method_called')
56 avatar_icon(user.email).to_s.should == "gravatar_method_called" 56 avatar_icon(user.email).to_s.should == "gravatar_method_called"
57 end 57 end
58 end 58 end
@@ -70,33 +70,33 @@ describe ApplicationHelper do @@ -70,33 +70,33 @@ describe ApplicationHelper do
70 end 70 end
71 71
72 it "should return default gravatar url" do 72 it "should return default gravatar url" do
73 - stub!(:request).and_return(double(:ssl? => false)) 73 + allow(self).to receive(:request).and_return(double(:ssl? => false))
74 gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118') 74 gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118')
75 end 75 end
76 76
77 it "should use SSL when appropriate" do 77 it "should use SSL when appropriate" do
78 - stub!(:request).and_return(double(:ssl? => true)) 78 + allow(self).to receive(:request).and_return(double(:ssl? => true))
79 gravatar_icon(user_email).should match('https://secure.gravatar.com') 79 gravatar_icon(user_email).should match('https://secure.gravatar.com')
80 end 80 end
81 81
82 it "should return custom gravatar path when gravatar_url is set" do 82 it "should return custom gravatar path when gravatar_url is set" do
83 - stub!(:request).and_return(double(:ssl? => false)) 83 + allow(self).to receive(:request).and_return(double(:ssl? => false))
84 Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') 84 Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}')
85 gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' 85 gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
86 end 86 end
87 87
88 it "should accept a custom size" do 88 it "should accept a custom size" do
89 - stub!(:request).and_return(double(:ssl? => false)) 89 + allow(self).to receive(:request).and_return(double(:ssl? => false))
90 gravatar_icon(user_email, 64).should match(/\?s=64/) 90 gravatar_icon(user_email, 64).should match(/\?s=64/)
91 end 91 end
92 92
93 it "should use default size when size is wrong" do 93 it "should use default size when size is wrong" do
94 - stub!(:request).and_return(double(:ssl? => false)) 94 + allow(self).to receive(:request).and_return(double(:ssl? => false))
95 gravatar_icon(user_email, nil).should match(/\?s=40/) 95 gravatar_icon(user_email, nil).should match(/\?s=40/)
96 end 96 end
97 97
98 it "should be case insensitive" do 98 it "should be case insensitive" do
99 - stub!(:request).and_return(double(:ssl? => false)) 99 + allow(self).to receive(:request).and_return(double(:ssl? => false))
100 gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + " ") 100 gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + " ")
101 end 101 end
102 102
@@ -105,7 +105,7 @@ describe ApplicationHelper do @@ -105,7 +105,7 @@ describe ApplicationHelper do
105 describe "user_color_scheme_class" do 105 describe "user_color_scheme_class" do
106 context "with current_user is nil" do 106 context "with current_user is nil" do
107 it "should return a string" do 107 it "should return a string" do
108 - stub!(:current_user).and_return(nil) 108 + allow(self).to receive(:current_user).and_return(nil)
109 user_color_scheme_class.should be_kind_of(String) 109 user_color_scheme_class.should be_kind_of(String)
110 end 110 end
111 end 111 end
@@ -115,7 +115,7 @@ describe ApplicationHelper do @@ -115,7 +115,7 @@ describe ApplicationHelper do
115 context "with color_scheme_id == #{color_scheme_id}" do 115 context "with color_scheme_id == #{color_scheme_id}" do
116 it "should return a string" do 116 it "should return a string" do
117 current_user = double(:color_scheme_id => color_scheme_id) 117 current_user = double(:color_scheme_id => color_scheme_id)
118 - stub!(:current_user).and_return(current_user) 118 + allow(self).to receive(:current_user).and_return(current_user)
119 user_color_scheme_class.should be_kind_of(String) 119 user_color_scheme_class.should be_kind_of(String)
120 end 120 end
121 end 121 end
spec/helpers/gitlab_markdown_helper_spec.rb
@@ -435,7 +435,7 @@ describe GitlabMarkdownHelper do @@ -435,7 +435,7 @@ describe GitlabMarkdownHelper do
435 435
436 describe "#render_wiki_content" do 436 describe "#render_wiki_content" do
437 before do 437 before do
438 - @wiki = stub('WikiPage') 438 + @wiki = double('WikiPage')
439 @wiki.stub(:content).and_return('wiki content') 439 @wiki.stub(:content).and_return('wiki content')
440 end 440 end
441 441
@@ -449,7 +449,7 @@ describe GitlabMarkdownHelper do @@ -449,7 +449,7 @@ describe GitlabMarkdownHelper do
449 449
450 it "should use the Gollum renderer for all other file types" do 450 it "should use the Gollum renderer for all other file types" do
451 @wiki.stub(:format).and_return(:rdoc) 451 @wiki.stub(:format).and_return(:rdoc)
452 - formatted_content_stub = stub('formatted_content') 452 + formatted_content_stub = double('formatted_content')
453 formatted_content_stub.should_receive(:html_safe) 453 formatted_content_stub.should_receive(:html_safe)
454 @wiki.stub(:formatted_content).and_return(formatted_content_stub) 454 @wiki.stub(:formatted_content).and_return(formatted_content_stub)
455 455
spec/helpers/notifications_helper_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper' @@ -2,7 +2,7 @@ require 'spec_helper'
2 2
3 describe NotificationsHelper do 3 describe NotificationsHelper do
4 describe 'notification_icon' do 4 describe 'notification_icon' do
5 - let(:notification) { stub(disabled?: false, participating?: false, watch?: false) } 5 + let(:notification) { double(disabled?: false, participating?: false, watch?: false) }
6 6
7 context "disabled notification" do 7 context "disabled notification" do
8 before { notification.stub(disabled?: true) } 8 before { notification.stub(disabled?: true) }
spec/helpers/search_helper_spec.rb
@@ -8,7 +8,9 @@ describe SearchHelper do @@ -8,7 +8,9 @@ describe SearchHelper do
8 8
9 describe 'search_autocomplete_source' do 9 describe 'search_autocomplete_source' do
10 context "with no current user" do 10 context "with no current user" do
11 - before { stub!(:current_user).and_return(nil) } 11 + before do
  12 + allow(self).to receive(:current_user).and_return(nil)
  13 + end
12 14
13 it "it returns nil" do 15 it "it returns nil" do
14 search_autocomplete_source.should be_nil 16 search_autocomplete_source.should be_nil
@@ -20,7 +22,7 @@ describe SearchHelper do @@ -20,7 +22,7 @@ describe SearchHelper do
20 let(:result) { JSON.parse(search_autocomplete_source) } 22 let(:result) { JSON.parse(search_autocomplete_source) }
21 23
22 before do 24 before do
23 - stub!(:current_user).and_return(user) 25 + allow(self).to receive(:current_user).and_return(user)
24 end 26 end
25 27
26 it "includes Help sections" do 28 it "includes Help sections" do
spec/helpers/tab_helper_spec.rb
@@ -5,8 +5,8 @@ describe TabHelper do @@ -5,8 +5,8 @@ describe TabHelper do
5 5
6 describe 'nav_link' do 6 describe 'nav_link' do
7 before do 7 before do
8 - controller.stub!(:controller_name).and_return('foo')  
9 - stub!(:action_name).and_return('foo') 8 + controller.stub(:controller_name).and_return('foo')
  9 + allow(self).to receive(:action_name).and_return('foo')
10 end 10 end
11 11
12 it "captures block output" do 12 it "captures block output" do
spec/lib/extracts_path_spec.rb
@@ -7,7 +7,7 @@ describe ExtractsPath do @@ -7,7 +7,7 @@ describe ExtractsPath do
7 7
8 before do 8 before do
9 @project = project 9 @project = project
10 - project.stub(repository: stub(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0'])) 10 + project.stub(repository: double(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0']))
11 project.stub(path_with_namespace: 'gitlab/gitlab-ci') 11 project.stub(path_with_namespace: 'gitlab/gitlab-ci')
12 end 12 end
13 13
spec/lib/gitlab/ldap/ldap_user_auth_spec.rb
@@ -6,7 +6,7 @@ describe Gitlab::LDAP do @@ -6,7 +6,7 @@ describe Gitlab::LDAP do
6 before do 6 before do
7 Gitlab.config.stub(omniauth: {}) 7 Gitlab.config.stub(omniauth: {})
8 8
9 - @info = mock( 9 + @info = double(
10 uid: '12djsak321', 10 uid: '12djsak321',
11 name: 'John', 11 name: 'John',
12 email: 'john@mail.com' 12 email: 'john@mail.com'
@@ -15,7 +15,7 @@ describe Gitlab::LDAP do @@ -15,7 +15,7 @@ describe Gitlab::LDAP do
15 15
16 describe :find_for_ldap_auth do 16 describe :find_for_ldap_auth do
17 before do 17 before do
18 - @auth = mock( 18 + @auth = double(
19 uid: '12djsak321', 19 uid: '12djsak321',
20 info: @info, 20 info: @info,
21 provider: 'ldap' 21 provider: 'ldap'
spec/lib/oauth_spec.rb
@@ -6,7 +6,7 @@ describe Gitlab::OAuth::User do @@ -6,7 +6,7 @@ describe Gitlab::OAuth::User do
6 before do 6 before do
7 Gitlab.config.stub(omniauth: {}) 7 Gitlab.config.stub(omniauth: {})
8 8
9 - @info = mock( 9 + @info = double(
10 uid: '12djsak321', 10 uid: '12djsak321',
11 name: 'John', 11 name: 'John',
12 email: 'john@mail.com' 12 email: 'john@mail.com'
@@ -15,7 +15,7 @@ describe Gitlab::OAuth::User do @@ -15,7 +15,7 @@ describe Gitlab::OAuth::User do
15 15
16 describe :create do 16 describe :create do
17 it "should create user from LDAP" do 17 it "should create user from LDAP" do
18 - @auth = mock(info: @info, provider: 'ldap') 18 + @auth = double(info: @info, provider: 'ldap')
19 user = gl_auth.create(@auth) 19 user = gl_auth.create(@auth)
20 20
21 user.should be_valid 21 user.should be_valid
@@ -24,7 +24,7 @@ describe Gitlab::OAuth::User do @@ -24,7 +24,7 @@ describe Gitlab::OAuth::User do
24 end 24 end
25 25
26 it "should create user from Omniauth" do 26 it "should create user from Omniauth" do
27 - @auth = mock(info: @info, provider: 'twitter') 27 + @auth = double(info: @info, provider: 'twitter')
28 user = gl_auth.create(@auth) 28 user = gl_auth.create(@auth)
29 29
30 user.should be_valid 30 user.should be_valid
@@ -33,7 +33,7 @@ describe Gitlab::OAuth::User do @@ -33,7 +33,7 @@ describe Gitlab::OAuth::User do
33 end 33 end
34 34
35 it "should apply defaults to user" do 35 it "should apply defaults to user" do
36 - @auth = mock(info: @info, provider: 'ldap') 36 + @auth = double(info: @info, provider: 'ldap')
37 user = gl_auth.create(@auth) 37 user = gl_auth.create(@auth)
38 38
39 user.should be_valid 39 user.should be_valid
spec/models/concerns/issuable_spec.rb
@@ -34,7 +34,7 @@ describe Issue, "Issuable" do @@ -34,7 +34,7 @@ describe Issue, "Issuable" do
34 let!(:searchable_issue) { create(:issue, title: "Searchable issue") } 34 let!(:searchable_issue) { create(:issue, title: "Searchable issue") }
35 35
36 it "matches by title" do 36 it "matches by title" do
37 - described_class.search('able').all.should == [searchable_issue] 37 + described_class.search('able').should == [searchable_issue]
38 end 38 end
39 end 39 end
40 40
spec/models/event_spec.rb
@@ -67,12 +67,12 @@ describe Event do @@ -67,12 +67,12 @@ describe Event do
67 end 67 end
68 68
69 describe 'Team events' do 69 describe 'Team events' do
70 - let(:user_project) { stub.as_null_object } 70 + let(:user_project) { double.as_null_object }
71 let(:observer) { UsersProjectObserver.instance } 71 let(:observer) { UsersProjectObserver.instance }
72 72
73 before { 73 before {
74 Event.should_receive :create 74 Event.should_receive :create
75 - observer.stub(notification: stub.as_null_object) 75 + observer.stub(notification: double.as_null_object)
76 } 76 }
77 77
78 describe "Joined project team" do 78 describe "Joined project team" do
spec/models/forked_project_link_spec.rb
@@ -59,7 +59,7 @@ end @@ -59,7 +59,7 @@ end
59 59
60 def fork_project(from_project, user) 60 def fork_project(from_project, user)
61 context = Projects::ForkContext.new(from_project, user) 61 context = Projects::ForkContext.new(from_project, user)
62 - shell = mock("gitlab_shell") 62 + shell = double("gitlab_shell")
63 shell.stub(fork_repository: true) 63 shell.stub(fork_repository: true)
64 context.stub(gitlab_shell: shell) 64 context.stub(gitlab_shell: shell)
65 context.execute 65 context.execute
spec/models/merge_request_spec.rb
@@ -107,9 +107,9 @@ describe MergeRequest do @@ -107,9 +107,9 @@ describe MergeRequest do
107 describe 'detection of issues to be closed' do 107 describe 'detection of issues to be closed' do
108 let(:issue0) { create :issue, project: subject.project } 108 let(:issue0) { create :issue, project: subject.project }
109 let(:issue1) { create :issue, project: subject.project } 109 let(:issue1) { create :issue, project: subject.project }
110 - let(:commit0) { mock('commit0', closes_issues: [issue0]) }  
111 - let(:commit1) { mock('commit1', closes_issues: [issue0]) }  
112 - let(:commit2) { mock('commit2', closes_issues: [issue1]) } 110 + let(:commit0) { double('commit0', closes_issues: [issue0]) }
  111 + let(:commit1) { double('commit1', closes_issues: [issue0]) }
  112 + let(:commit2) { double('commit2', closes_issues: [issue1]) }
113 113
114 before do 114 before do
115 subject.stub(commits: [commit0, commit1, commit2]) 115 subject.stub(commits: [commit0, commit1, commit2])
spec/observers/note_observer_spec.rb
@@ -2,7 +2,7 @@ require 'spec_helper' @@ -2,7 +2,7 @@ require 'spec_helper'
2 2
3 describe NoteObserver do 3 describe NoteObserver do
4 subject { NoteObserver.instance } 4 subject { NoteObserver.instance }
5 - before { subject.stub(notification: mock('NotificationService').as_null_object) } 5 + before { subject.stub(notification: double('NotificationService').as_null_object) }
6 6
7 let(:team_without_author) { (1..2).map { |n| double :user, id: n } } 7 let(:team_without_author) { (1..2).map { |n| double :user, id: n } }
8 let(:note) { double(:note).as_null_object } 8 let(:note) { double(:note).as_null_object }
spec/requests/api/groups_spec.rb
@@ -147,7 +147,7 @@ describe API::API do @@ -147,7 +147,7 @@ describe API::API do
147 describe "POST /groups/:id/projects/:project_id" do 147 describe "POST /groups/:id/projects/:project_id" do
148 let(:project) { create(:project) } 148 let(:project) { create(:project) }
149 before(:each) do 149 before(:each) do
150 - project.stub!(:transfer).and_return(true) 150 + project.stub(:transfer).and_return(true)
151 Project.stub(:find).and_return(project) 151 Project.stub(:find).and_return(project)
152 end 152 end
153 153