diff --git a/spec/controllers/api/v1/build_lists_controller_spec.rb b/spec/controllers/api/v1/build_lists_controller_spec.rb index 154c8e057..b05b4534b 100644 --- a/spec/controllers/api/v1/build_lists_controller_spec.rb +++ b/spec/controllers/api/v1/build_lists_controller_spec.rb @@ -468,7 +468,7 @@ describe Api::V1::BuildListsController, type: :controller do context "do reject_publish" do before do - any_instance_of(BuildList, current_duration: 100) + allow_any_instance_of(BuildList).to receive(:current_duration).and_return(100) @build_list.save_to_repository.update_column(:publish_without_qa, false) end @@ -636,7 +636,7 @@ describe Api::V1::BuildListsController, type: :controller do # Create and show params: @create_params = {build_list: @build_list.attributes.symbolize_keys} @create_params = @create_params.merge(arches: [@params[:arch_id]], build_for_platform_id: @platform.id, format: :json) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) # Groups: @owner_group = FactoryGirl.create(:group, owner: @owner_user) diff --git a/spec/controllers/api/v1/issues_controller_spec.rb b/spec/controllers/api/v1/issues_controller_spec.rb index ccb671fcf..26a0918fc 100644 --- a/spec/controllers/api/v1/issues_controller_spec.rb +++ b/spec/controllers/api/v1/issues_controller_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe Api::V1::IssuesController, type: :controller do before do stub_symlink_methods - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) @project = FactoryGirl.create(:project_with_commit) @issue = FactoryGirl.create(:issue, project: @project) diff --git a/spec/controllers/projects/build_lists_controller_spec.rb b/spec/controllers/projects/build_lists_controller_spec.rb index 99768e678..66bc1cffb 100644 --- a/spec/controllers/projects/build_lists_controller_spec.rb +++ b/spec/controllers/projects/build_lists_controller_spec.rb @@ -92,7 +92,7 @@ describe Projects::BuildListsController, type: :controller do arches: [FactoryGirl.create(:arch).id], build_for_platforms: [@platform.id] } - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) end context 'for guest' do @@ -110,7 +110,7 @@ describe Projects::BuildListsController, type: :controller do context 'for user' do before do - any_instance_of(BuildList, current_duration: 100) + allow_any_instance_of(BuildList).to receive(:current_duration).and_return(100) @build_list = FactoryGirl.create(:build_list) @project = @build_list.project @owner_user = @project.owner diff --git a/spec/controllers/projects/comments_controller_for_commit_spec.rb b/spec/controllers/projects/comments_controller_for_commit_spec.rb index aeb90e404..3d60f19f3 100644 --- a/spec/controllers/projects/comments_controller_for_commit_spec.rb +++ b/spec/controllers/projects/comments_controller_for_commit_spec.rb @@ -10,7 +10,8 @@ describe Projects::CommentsController, type: :controller do commit_id: @commit.id, format: :json } @update_params = { comment: { body: 'updated' }, name_with_owner: @project.name_with_owner, commit_id: @commit.id } - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) + @comment = FactoryGirl.create(:comment, commentable: @commit, project: @project) @user = FactoryGirl.create(:user) @own_comment = FactoryGirl.create(:comment, commentable: @commit, user: @user, project: @project) diff --git a/spec/controllers/projects/subscribes_controller_spec.rb b/spec/controllers/projects/subscribes_controller_spec.rb index 2afca1343..a9b593bad 100644 --- a/spec/controllers/projects/subscribes_controller_spec.rb +++ b/spec/controllers/projects/subscribes_controller_spec.rb @@ -56,7 +56,7 @@ describe Projects::SubscribesController, type: :controller do @create_params = { issue_id: @issue.serial_id, name_with_owner: @project.name_with_owner } @destroy_params = { issue_id: @issue.serial_id, name_with_owner: @project.name_with_owner } - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) @request.env['HTTP_REFERER'] = project_issue_path(@project, @issue) end diff --git a/spec/mailers/user_mailer_spec.rb b/spec/mailers/user_mailer_spec.rb index ce479b31a..92e267d7c 100644 --- a/spec/mailers/user_mailer_spec.rb +++ b/spec/mailers/user_mailer_spec.rb @@ -9,7 +9,7 @@ describe UserMailer do @project = FactoryGirl.create(:project) @issue_user = FactoryGirl.create(:user) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) @issue = FactoryGirl.create(:issue, project: @project, assignee: @issue_user, user: @issue_user) @email = UserMailer.new_issue_notification(@issue, @issue_user).deliver! @@ -44,7 +44,7 @@ describe UserMailer do @issue_user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) @issue = FactoryGirl.create(:issue, project_id: @project.id, assignee_id: @issue_user.id, user: @issue_user) @email = UserMailer.issue_assign_notification(@issue, @user).deliver! @@ -76,7 +76,7 @@ describe UserMailer do @issue_user = FactoryGirl.create(:user) @user = FactoryGirl.create(:user) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) @issue = FactoryGirl.create(:issue, project: @project, assignee: @issue_user, user: @issue_user) @comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project: @project) diff --git a/spec/models/comment_for_commit_spec.rb b/spec/models/comment_for_commit_spec.rb index 13f89dcbc..7b920e395 100644 --- a/spec/models/comment_for_commit_spec.rb +++ b/spec/models/comment_for_commit_spec.rb @@ -21,7 +21,7 @@ def set_comments_data_for_commit @subscribe_params = {project_id: @project.id, subscribeable_id: @commit.id.hex, subscribeable_type: @commit.class.name} Subscribe.destroy_all - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) end def should_send_email(args={}) diff --git a/spec/models/comment_spec.rb b/spec/models/comment_spec.rb index 4bcb21b72..c18a45446 100644 --- a/spec/models/comment_spec.rb +++ b/spec/models/comment_spec.rb @@ -10,7 +10,7 @@ def set_commentable_data @comment = FactoryGirl.create(:comment, commentable: @issue, user: @user, project: @project) @stranger_comment = FactoryGirl.create(:comment, commentable: @issue, user: @stranger, project: @project) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) end def create_comment_in_issue issue, body diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index 5cd1667c6..40ea8396c 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -14,7 +14,7 @@ end describe Issue do before do stub_symlink_methods - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) end diff --git a/spec/models/pull_request_spec.rb b/spec/models/pull_request_spec.rb index 6a7ffb40d..069125dbf 100644 --- a/spec/models/pull_request_spec.rb +++ b/spec/models/pull_request_spec.rb @@ -10,7 +10,7 @@ def set_data_for_pull @other_project = FactoryGirl.create(:project_with_commit, owner: @user) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) end describe PullRequest do diff --git a/spec/models/subscribe_spec.rb b/spec/models/subscribe_spec.rb index 192fcb687..263d142c3 100644 --- a/spec/models/subscribe_spec.rb +++ b/spec/models/subscribe_spec.rb @@ -7,7 +7,7 @@ def set_testable_data @project = FactoryGirl.create(:project) @issue = FactoryGirl.create(:issue, project_id: @project.id) - any_instance_of(Project, versions: ['v1.0', 'v2.0']) + allow_any_instance_of(Project).to receive(:versions).and_return(%w(v1.0 v2.0)) end describe Subscribe do