Commit d46dba58 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #5847 from skv-headless/fix_deprecation_warnings

fix most of warnings
parents 4227f6ed d8952783
...@@ -7,7 +7,7 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -7,7 +7,7 @@ class Admin::ProjectsController < Admin::ApplicationController
owner_id = params[:owner_id] owner_id = params[:owner_id]
user = User.find_by_id(owner_id) user = User.find_by_id(owner_id)
@projects = user ? user.owned_projects : Project.scoped @projects = user ? user.owned_projects : Project.all
@projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present?
@projects = @projects.with_push if params[:with_push].present? @projects = @projects.with_push if params[:with_push].present?
@projects = @projects.abandoned if params[:abandoned].present? @projects = @projects.abandoned if params[:abandoned].present?
......
...@@ -2,8 +2,7 @@ class Admin::UsersController < Admin::ApplicationController ...@@ -2,8 +2,7 @@ class Admin::UsersController < Admin::ApplicationController
before_filter :user, only: [:show, :edit, :update, :destroy] before_filter :user, only: [:show, :edit, :update, :destroy]
def index def index
@users = User.scoped @users = User.filter(params[:filter])
@users = @users.filter(params[:filter])
@users = @users.search(params[:name]) if params[:name].present? @users = @users.search(params[:name]) if params[:name].present?
@users = @users.alphabetically.page(params[:page]) @users = @users.alphabetically.page(params[:page])
end end
......
...@@ -2,7 +2,7 @@ class Profiles::KeysController < ApplicationController ...@@ -2,7 +2,7 @@ class Profiles::KeysController < ApplicationController
layout "profile" layout "profile"
def index def index
@keys = current_user.keys.order('id DESC').all @keys = current_user.keys.order('id DESC')
end end
def show def show
......
...@@ -7,7 +7,7 @@ class Projects::DeployKeysController < Projects::ApplicationController ...@@ -7,7 +7,7 @@ class Projects::DeployKeysController < Projects::ApplicationController
layout "project_settings" layout "project_settings"
def index def index
@enabled_keys = @project.deploy_keys.all @enabled_keys = @project.deploy_keys
@available_keys = available_keys - @enabled_keys @available_keys = available_keys - @enabled_keys
end end
......
...@@ -7,7 +7,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -7,7 +7,7 @@ class Projects::HooksController < Projects::ApplicationController
layout "project_settings" layout "project_settings"
def index def index
@hooks = @project.hooks.all @hooks = @project.hooks
@hook = ProjectHook.new @hook = ProjectHook.new
end end
...@@ -18,7 +18,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -18,7 +18,7 @@ class Projects::HooksController < Projects::ApplicationController
if @hook.valid? if @hook.valid?
redirect_to project_hooks_path(@project) redirect_to project_hooks_path(@project)
else else
@hooks = @project.hooks.all @hooks = @project.hooks
render :index render :index
end end
end end
......
...@@ -322,14 +322,14 @@ class Project < ActiveRecord::Base ...@@ -322,14 +322,14 @@ class Project < ActiveRecord::Base
c_ids = self.repository.commits_between(oldrev, newrev).map(&:id) c_ids = self.repository.commits_between(oldrev, newrev).map(&:id)
# Update code for merge requests into project between project branches # Update code for merge requests into project between project branches
mrs = self.merge_requests.opened.by_branch(branch_name).all mrs = self.merge_requests.opened.by_branch(branch_name).to_a
# Update code for merge requests between project and project fork # Update code for merge requests between project and project fork
mrs += self.fork_merge_requests.opened.by_branch(branch_name).all mrs += self.fork_merge_requests.opened.by_branch(branch_name).to_a
mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked }
# Close merge requests # Close merge requests
mrs = self.merge_requests.opened.where(target_branch: branch_name).all mrs = self.merge_requests.opened.where(target_branch: branch_name).to_a
mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) } mrs = mrs.select(&:last_commit).select { |mr| c_ids.include?(mr.last_commit.id) }
mrs.each { |merge_request| merge_request.merge!(user.id) } mrs.each { |merge_request| merge_request.merge!(user.id) }
......
...@@ -87,8 +87,8 @@ class ProjectTeam ...@@ -87,8 +87,8 @@ class ProjectTeam
def import(source_project) def import(source_project)
target_project = project target_project = project
source_team = source_project.users_projects.all source_team = source_project.users_projects.to_a
target_team = target_project.users_projects.all target_team = target_project.users_projects.to_a
target_user_ids = target_team.map(&:user_id) target_user_ids = target_team.map(&:user_id)
source_team.reject! do |tm| source_team.reject! do |tm|
......
...@@ -163,7 +163,7 @@ class User < ActiveRecord::Base ...@@ -163,7 +163,7 @@ class User < ActiveRecord::Base
scope :alphabetically, -> { order('name ASC') } scope :alphabetically, -> { order('name ASC') }
scope :in_team, ->(team){ where(id: team.member_ids) } scope :in_team, ->(team){ where(id: team.member_ids) }
scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) } scope :not_in_team, ->(team){ where('users.id NOT IN (:ids)', ids: team.member_ids) }
scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : scoped } scope :not_in_project, ->(project) { project.users.present? ? where("id not in (:ids)", ids: project.users.map(&:id) ) : all }
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') } scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM users_projects)') }
scope :ldap, -> { where(provider: 'ldap') } scope :ldap, -> { where(provider: 'ldap') }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
= f.label :milestone_id do = f.label :milestone_id do
%i.icon-time %i.icon-time
Milestone Milestone
.controls= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) .controls= f.select(:milestone_id, @project.milestones.active.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
.ui-box-bottom .ui-box-bottom
.control-group .control-group
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
= f.label :milestone_id do = f.label :milestone_id do
%i.icon-time %i.icon-time
Milestone Milestone
.controls= f.select(:milestone_id, @project.milestones.active.all.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'}) .controls= f.select(:milestone_id, @project.milestones.active.map {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
.control-group .control-group
= f.label :description, "Description" = f.label :description, "Description"
.controls .controls
......
...@@ -12,7 +12,7 @@ module API ...@@ -12,7 +12,7 @@ module API
# Example Request: # Example Request:
# GET /namespaces # GET /namespaces
get do get do
@namespaces = Namespace.scoped @namespaces = Namespace.all
@namespaces = @namespaces.search(params[:search]) if params[:search].present? @namespaces = @namespaces.search(params[:search]) if params[:search].present?
@namespaces = paginate @namespaces @namespaces = paginate @namespaces
......
...@@ -9,7 +9,7 @@ module API ...@@ -9,7 +9,7 @@ module API
# Example Request: # Example Request:
# GET /users # GET /users
get do get do
@users = User.scoped @users = User.all
@users = @users.active if params[:active].present? @users = @users.active if params[:active].present?
@users = @users.search(params[:search]) if params[:search].present? @users = @users.search(params[:search]) if params[:search].present?
@users = paginate @users @users = paginate @users
......
...@@ -48,7 +48,7 @@ describe Projects::ForkContext do ...@@ -48,7 +48,7 @@ describe Projects::ForkContext do
def fork_project(from_project, user, fork_success = true) def fork_project(from_project, user, fork_success = true)
context = Projects::ForkContext.new(from_project, user) context = Projects::ForkContext.new(from_project, user)
shell = mock("gitlab_shell") shell = double("gitlab_shell")
shell.stub(fork_repository: fork_success) shell.stub(fork_repository: fork_success)
context.stub(gitlab_shell: shell) context.stub(gitlab_shell: shell)
context.execute context.execute
......
...@@ -8,7 +8,7 @@ describe ApplicationController do ...@@ -8,7 +8,7 @@ describe ApplicationController do
it 'should redirect if the user is over their password expiry' do it 'should redirect if the user is over their password expiry' do
user.password_expires_at = Time.new(2002) user.password_expires_at = Time.new(2002)
user.ldap_user?.should be_false user.ldap_user?.should be_false
controller.stub!(:current_user).and_return(user) controller.stub(:current_user).and_return(user)
controller.should_receive(:redirect_to) controller.should_receive(:redirect_to)
controller.should_receive(:new_profile_password_path) controller.should_receive(:new_profile_password_path)
controller.send(:check_password_expiration) controller.send(:check_password_expiration)
...@@ -17,15 +17,15 @@ describe ApplicationController do ...@@ -17,15 +17,15 @@ describe ApplicationController do
it 'should not redirect if the user is under their password expiry' do it 'should not redirect if the user is under their password expiry' do
user.password_expires_at = Time.now + 20010101 user.password_expires_at = Time.now + 20010101
user.ldap_user?.should be_false user.ldap_user?.should be_false
controller.stub!(:current_user).and_return(user) controller.stub(:current_user).and_return(user)
controller.should_not_receive(:redirect_to) controller.should_not_receive(:redirect_to)
controller.send(:check_password_expiration) controller.send(:check_password_expiration)
end end
it 'should not redirect if the user is over their password expiry but they are an ldap user' do it 'should not redirect if the user is over their password expiry but they are an ldap user' do
user.password_expires_at = Time.new(2002) user.password_expires_at = Time.new(2002)
user.stub!(:ldap_user?).and_return(true) user.stub(:ldap_user?).and_return(true)
controller.stub!(:current_user).and_return(user) controller.stub(:current_user).and_return(user)
controller.should_not_receive(:redirect_to) controller.should_not_receive(:redirect_to)
controller.send(:check_password_expiration) controller.send(:check_password_expiration)
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe ApplicationHelper do describe ApplicationHelper do
describe 'current_controller?' do describe 'current_controller?' do
before do before do
controller.stub!(:controller_name).and_return('foo') controller.stub(:controller_name).and_return('foo')
end end
it "returns true when controller matches argument" do it "returns true when controller matches argument" do
...@@ -22,7 +22,7 @@ describe ApplicationHelper do ...@@ -22,7 +22,7 @@ describe ApplicationHelper do
describe 'current_action?' do describe 'current_action?' do
before do before do
stub!(:action_name).and_return('foo') allow(self).to receive(:action_name).and_return('foo')
end end
it "returns true when action matches argument" do it "returns true when action matches argument" do
...@@ -52,7 +52,7 @@ describe ApplicationHelper do ...@@ -52,7 +52,7 @@ describe ApplicationHelper do
it "should call gravatar_icon when no avatar is present" do it "should call gravatar_icon when no avatar is present" do
user = create(:user) user = create(:user)
user.save! user.save!
stub!(:gravatar_icon).and_return('gravatar_method_called') allow(self).to receive(:gravatar_icon).and_return('gravatar_method_called')
avatar_icon(user.email).to_s.should == "gravatar_method_called" avatar_icon(user.email).to_s.should == "gravatar_method_called"
end end
end end
...@@ -70,33 +70,33 @@ describe ApplicationHelper do ...@@ -70,33 +70,33 @@ describe ApplicationHelper do
end end
it "should return default gravatar url" do it "should return default gravatar url" do
stub!(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118') gravatar_icon(user_email).should match('http://www.gravatar.com/avatar/b58c6f14d292556214bd64909bcdb118')
end end
it "should use SSL when appropriate" do it "should use SSL when appropriate" do
stub!(:request).and_return(double(:ssl? => true)) allow(self).to receive(:request).and_return(double(:ssl? => true))
gravatar_icon(user_email).should match('https://secure.gravatar.com') gravatar_icon(user_email).should match('https://secure.gravatar.com')
end end
it "should return custom gravatar path when gravatar_url is set" do it "should return custom gravatar path when gravatar_url is set" do
stub!(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}') Gitlab.config.gravatar.stub(:plain_url).and_return('http://example.local/?s=%{size}&hash=%{hash}')
gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118' gravatar_icon(user_email, 20).should == 'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
end end
it "should accept a custom size" do it "should accept a custom size" do
stub!(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email, 64).should match(/\?s=64/) gravatar_icon(user_email, 64).should match(/\?s=64/)
end end
it "should use default size when size is wrong" do it "should use default size when size is wrong" do
stub!(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email, nil).should match(/\?s=40/) gravatar_icon(user_email, nil).should match(/\?s=40/)
end end
it "should be case insensitive" do it "should be case insensitive" do
stub!(:request).and_return(double(:ssl? => false)) allow(self).to receive(:request).and_return(double(:ssl? => false))
gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + " ") gravatar_icon(user_email).should == gravatar_icon(user_email.upcase + " ")
end end
...@@ -105,7 +105,7 @@ describe ApplicationHelper do ...@@ -105,7 +105,7 @@ describe ApplicationHelper do
describe "user_color_scheme_class" do describe "user_color_scheme_class" do
context "with current_user is nil" do context "with current_user is nil" do
it "should return a string" do it "should return a string" do
stub!(:current_user).and_return(nil) allow(self).to receive(:current_user).and_return(nil)
user_color_scheme_class.should be_kind_of(String) user_color_scheme_class.should be_kind_of(String)
end end
end end
...@@ -115,7 +115,7 @@ describe ApplicationHelper do ...@@ -115,7 +115,7 @@ describe ApplicationHelper do
context "with color_scheme_id == #{color_scheme_id}" do context "with color_scheme_id == #{color_scheme_id}" do
it "should return a string" do it "should return a string" do
current_user = double(:color_scheme_id => color_scheme_id) current_user = double(:color_scheme_id => color_scheme_id)
stub!(:current_user).and_return(current_user) allow(self).to receive(:current_user).and_return(current_user)
user_color_scheme_class.should be_kind_of(String) user_color_scheme_class.should be_kind_of(String)
end end
end end
......
...@@ -435,7 +435,7 @@ describe GitlabMarkdownHelper do ...@@ -435,7 +435,7 @@ describe GitlabMarkdownHelper do
describe "#render_wiki_content" do describe "#render_wiki_content" do
before do before do
@wiki = stub('WikiPage') @wiki = double('WikiPage')
@wiki.stub(:content).and_return('wiki content') @wiki.stub(:content).and_return('wiki content')
end end
...@@ -449,7 +449,7 @@ describe GitlabMarkdownHelper do ...@@ -449,7 +449,7 @@ describe GitlabMarkdownHelper do
it "should use the Gollum renderer for all other file types" do it "should use the Gollum renderer for all other file types" do
@wiki.stub(:format).and_return(:rdoc) @wiki.stub(:format).and_return(:rdoc)
formatted_content_stub = stub('formatted_content') formatted_content_stub = double('formatted_content')
formatted_content_stub.should_receive(:html_safe) formatted_content_stub.should_receive(:html_safe)
@wiki.stub(:formatted_content).and_return(formatted_content_stub) @wiki.stub(:formatted_content).and_return(formatted_content_stub)
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe NotificationsHelper do describe NotificationsHelper do
describe 'notification_icon' do describe 'notification_icon' do
let(:notification) { stub(disabled?: false, participating?: false, watch?: false) } let(:notification) { double(disabled?: false, participating?: false, watch?: false) }
context "disabled notification" do context "disabled notification" do
before { notification.stub(disabled?: true) } before { notification.stub(disabled?: true) }
......
...@@ -8,7 +8,9 @@ describe SearchHelper do ...@@ -8,7 +8,9 @@ describe SearchHelper do
describe 'search_autocomplete_source' do describe 'search_autocomplete_source' do
context "with no current user" do context "with no current user" do
before { stub!(:current_user).and_return(nil) } before do
allow(self).to receive(:current_user).and_return(nil)
end
it "it returns nil" do it "it returns nil" do
search_autocomplete_source.should be_nil search_autocomplete_source.should be_nil
...@@ -20,7 +22,7 @@ describe SearchHelper do ...@@ -20,7 +22,7 @@ describe SearchHelper do
let(:result) { JSON.parse(search_autocomplete_source) } let(:result) { JSON.parse(search_autocomplete_source) }
before do before do
stub!(:current_user).and_return(user) allow(self).to receive(:current_user).and_return(user)
end end
it "includes Help sections" do it "includes Help sections" do
......
...@@ -5,8 +5,8 @@ describe TabHelper do ...@@ -5,8 +5,8 @@ describe TabHelper do
describe 'nav_link' do describe 'nav_link' do
before do before do
controller.stub!(:controller_name).and_return('foo') controller.stub(:controller_name).and_return('foo')
stub!(:action_name).and_return('foo') allow(self).to receive(:action_name).and_return('foo')
end end
it "captures block output" do it "captures block output" do
......
...@@ -7,7 +7,7 @@ describe ExtractsPath do ...@@ -7,7 +7,7 @@ describe ExtractsPath do
before do before do
@project = project @project = project
project.stub(repository: stub(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0'])) project.stub(repository: double(ref_names: ['master', 'foo/bar/baz', 'v1.0.0', 'v2.0.0']))
project.stub(path_with_namespace: 'gitlab/gitlab-ci') project.stub(path_with_namespace: 'gitlab/gitlab-ci')
end end
......
...@@ -6,7 +6,7 @@ describe Gitlab::LDAP do ...@@ -6,7 +6,7 @@ describe Gitlab::LDAP do
before do before do
Gitlab.config.stub(omniauth: {}) Gitlab.config.stub(omniauth: {})
@info = mock( @info = double(
uid: '12djsak321', uid: '12djsak321',
name: 'John', name: 'John',
email: 'john@mail.com' email: 'john@mail.com'
...@@ -15,7 +15,7 @@ describe Gitlab::LDAP do ...@@ -15,7 +15,7 @@ describe Gitlab::LDAP do
describe :find_for_ldap_auth do describe :find_for_ldap_auth do
before do before do
@auth = mock( @auth = double(
uid: '12djsak321', uid: '12djsak321',
info: @info, info: @info,
provider: 'ldap' provider: 'ldap'
......
...@@ -6,7 +6,7 @@ describe Gitlab::OAuth::User do ...@@ -6,7 +6,7 @@ describe Gitlab::OAuth::User do
before do before do
Gitlab.config.stub(omniauth: {}) Gitlab.config.stub(omniauth: {})
@info = mock( @info = double(
uid: '12djsak321', uid: '12djsak321',
name: 'John', name: 'John',
email: 'john@mail.com' email: 'john@mail.com'
...@@ -15,7 +15,7 @@ describe Gitlab::OAuth::User do ...@@ -15,7 +15,7 @@ describe Gitlab::OAuth::User do
describe :create do describe :create do
it "should create user from LDAP" do it "should create user from LDAP" do
@auth = mock(info: @info, provider: 'ldap') @auth = double(info: @info, provider: 'ldap')
user = gl_auth.create(@auth) user = gl_auth.create(@auth)
user.should be_valid user.should be_valid
...@@ -24,7 +24,7 @@ describe Gitlab::OAuth::User do ...@@ -24,7 +24,7 @@ describe Gitlab::OAuth::User do
end end
it "should create user from Omniauth" do it "should create user from Omniauth" do
@auth = mock(info: @info, provider: 'twitter') @auth = double(info: @info, provider: 'twitter')
user = gl_auth.create(@auth) user = gl_auth.create(@auth)
user.should be_valid user.should be_valid
...@@ -33,7 +33,7 @@ describe Gitlab::OAuth::User do ...@@ -33,7 +33,7 @@ describe Gitlab::OAuth::User do
end end
it "should apply defaults to user" do it "should apply defaults to user" do
@auth = mock(info: @info, provider: 'ldap') @auth = double(info: @info, provider: 'ldap')
user = gl_auth.create(@auth) user = gl_auth.create(@auth)
user.should be_valid user.should be_valid
......
...@@ -34,7 +34,7 @@ describe Issue, "Issuable" do ...@@ -34,7 +34,7 @@ describe Issue, "Issuable" do
let!(:searchable_issue) { create(:issue, title: "Searchable issue") } let!(:searchable_issue) { create(:issue, title: "Searchable issue") }
it "matches by title" do it "matches by title" do
described_class.search('able').all.should == [searchable_issue] described_class.search('able').should == [searchable_issue]
end end
end end
......
...@@ -67,12 +67,12 @@ describe Event do ...@@ -67,12 +67,12 @@ describe Event do
end end
describe 'Team events' do describe 'Team events' do
let(:user_project) { stub.as_null_object } let(:user_project) { double.as_null_object }
let(:observer) { UsersProjectObserver.instance } let(:observer) { UsersProjectObserver.instance }
before { before {
Event.should_receive :create Event.should_receive :create
observer.stub(notification: stub.as_null_object) observer.stub(notification: double.as_null_object)
} }
describe "Joined project team" do describe "Joined project team" do
......
...@@ -59,7 +59,7 @@ end ...@@ -59,7 +59,7 @@ end
def fork_project(from_project, user) def fork_project(from_project, user)
context = Projects::ForkContext.new(from_project, user) context = Projects::ForkContext.new(from_project, user)
shell = mock("gitlab_shell") shell = double("gitlab_shell")
shell.stub(fork_repository: true) shell.stub(fork_repository: true)
context.stub(gitlab_shell: shell) context.stub(gitlab_shell: shell)
context.execute context.execute
......
...@@ -107,9 +107,9 @@ describe MergeRequest do ...@@ -107,9 +107,9 @@ describe MergeRequest do
describe 'detection of issues to be closed' do describe 'detection of issues to be closed' do
let(:issue0) { create :issue, project: subject.project } let(:issue0) { create :issue, project: subject.project }
let(:issue1) { create :issue, project: subject.project } let(:issue1) { create :issue, project: subject.project }
let(:commit0) { mock('commit0', closes_issues: [issue0]) } let(:commit0) { double('commit0', closes_issues: [issue0]) }
let(:commit1) { mock('commit1', closes_issues: [issue0]) } let(:commit1) { double('commit1', closes_issues: [issue0]) }
let(:commit2) { mock('commit2', closes_issues: [issue1]) } let(:commit2) { double('commit2', closes_issues: [issue1]) }
before do before do
subject.stub(commits: [commit0, commit1, commit2]) subject.stub(commits: [commit0, commit1, commit2])
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe NoteObserver do describe NoteObserver do
subject { NoteObserver.instance } subject { NoteObserver.instance }
before { subject.stub(notification: mock('NotificationService').as_null_object) } before { subject.stub(notification: double('NotificationService').as_null_object) }
let(:team_without_author) { (1..2).map { |n| double :user, id: n } } let(:team_without_author) { (1..2).map { |n| double :user, id: n } }
let(:note) { double(:note).as_null_object } let(:note) { double(:note).as_null_object }
......
...@@ -147,7 +147,7 @@ describe API::API do ...@@ -147,7 +147,7 @@ describe API::API do
describe "POST /groups/:id/projects/:project_id" do describe "POST /groups/:id/projects/:project_id" do
let(:project) { create(:project) } let(:project) { create(:project) }
before(:each) do before(:each) do
project.stub!(:transfer).and_return(true) project.stub(:transfer).and_return(true)
Project.stub(:find).and_return(project) Project.stub(:find).and_return(project)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment