Skip to content
Snippets Groups Projects
Verified Commit 4a1654ed authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Replace context with service in specs

parent 1d2bdb4d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -58,7 +58,7 @@ describe :forked_from_project do
end
 
def fork_project(from_project, user)
context = Projects::ForkContext.new(from_project, user)
context = Projects::ForkService.new(from_project, user)
shell = double("gitlab_shell")
shell.stub(fork_repository: true)
context.stub(gitlab_shell: shell)
Loading
Loading
require 'spec_helper'
 
describe Projects::ForkContext do
describe Projects::ForkService do
describe :fork_by_user do
before do
@from_namespace = create(:namespace)
Loading
Loading
@@ -47,7 +47,7 @@ describe Projects::ForkContext do
end
 
def fork_project(from_project, user, fork_success = true)
context = Projects::ForkContext.new(from_project, user)
context = Projects::ForkService.new(from_project, user)
shell = double("gitlab_shell")
shell.stub(fork_repository: fork_success)
context.stub(gitlab_shell: shell)
Loading
Loading
require 'spec_helper'
 
describe Issues::BulkUpdateContext do
describe Issues::BulkUpdateService do
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
 
Loading
Loading
@@ -14,7 +14,7 @@ describe Issues::BulkUpdateContext do
name: "GitLab",
namespace: @user.namespace
}
@project = Projects::CreateContext.new(@user, opts).execute
@project = Projects::CreateService.new(@user, opts).execute
end
 
describe :close_issue do
Loading
Loading
@@ -32,7 +32,7 @@ describe Issues::BulkUpdateContext do
end
 
it {
result = Issues::BulkUpdateContext.new(@project, @user, @params).execute
result = Issues::BulkUpdateService.new(@project, @user, @params).execute
result[:success].should be_true
result[:count].should == @issues.count
 
Loading
Loading
@@ -57,7 +57,7 @@ describe Issues::BulkUpdateContext do
end
 
it {
result = Issues::BulkUpdateContext.new(@project, @user, @params).execute
result = Issues::BulkUpdateService.new(@project, @user, @params).execute
result[:success].should be_true
result[:count].should == @issues.count
 
Loading
Loading
@@ -80,7 +80,7 @@ describe Issues::BulkUpdateContext do
end
 
it {
result = Issues::BulkUpdateContext.new(@project, @user, @params).execute
result = Issues::BulkUpdateService.new(@project, @user, @params).execute
result[:success].should be_true
result[:count].should == 1
 
Loading
Loading
@@ -102,7 +102,7 @@ describe Issues::BulkUpdateContext do
end
 
it {
result = Issues::BulkUpdateContext.new(@project, @user, @params).execute
result = Issues::BulkUpdateService.new(@project, @user, @params).execute
result[:success].should be_true
result[:count].should == 1
 
Loading
Loading
require 'spec_helper'
 
describe Projects::CreateContext do
describe Projects::CreateService do
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
 
Loading
Loading
@@ -136,7 +136,7 @@ describe Projects::CreateContext do
end
 
def create_project(user, opts)
Projects::CreateContext.new(user, opts).execute
Projects::CreateService.new(user, opts).execute
end
end
 
require 'spec_helper'
 
describe Projects::UpdateContext do
describe Projects::UpdateService do
before(:each) { ActiveRecord::Base.observers.enable(:user_observer) }
after(:each) { ActiveRecord::Base.observers.disable(:user_observer) }
 
Loading
Loading
@@ -106,6 +106,6 @@ describe Projects::UpdateContext do
end
 
def update_project(project, user, opts)
Projects::UpdateContext.new(project, user, opts).execute
Projects::UpdateService.new(project, user, opts).execute
end
end
\ No newline at end of file
end
require 'spec_helper'
 
describe 'Search::GlobalContext' do
describe 'Search::GlobalService' do
let(:found_namespace) { create(:namespace, name: 'searchable namespace', path:'another_thing') }
let(:user) { create(:user, namespace: found_namespace) }
let!(:found_project) { create(:project, name: 'searchable_project', creator_id: user.id, namespace: found_namespace, visibility_level: Gitlab::VisibilityLevel::PRIVATE) }
Loading
Loading
@@ -19,7 +19,7 @@ describe 'Search::GlobalContext' do
describe '#execute' do
context 'unauthenticated' do
it 'should return public projects only' do
context = Search::GlobalContext.new(nil, search: "searchable")
context = Search::GlobalService.new(nil, search: "searchable")
results = context.execute
results[:projects].should have(1).items
results[:projects].should include(public_project)
Loading
Loading
@@ -28,7 +28,7 @@ describe 'Search::GlobalContext' do
 
context 'authenticated' do
it 'should return public, internal and private projects' do
context = Search::GlobalContext.new(user, search: "searchable")
context = Search::GlobalService.new(user, search: "searchable")
results = context.execute
results[:projects].should have(3).items
results[:projects].should include(public_project)
Loading
Loading
@@ -37,7 +37,7 @@ describe 'Search::GlobalContext' do
end
 
it 'should return only public & internal projects' do
context = Search::GlobalContext.new(internal_user, search: "searchable")
context = Search::GlobalService.new(internal_user, search: "searchable")
results = context.execute
results[:projects].should have(2).items
results[:projects].should include(internal_project)
Loading
Loading
@@ -45,7 +45,7 @@ describe 'Search::GlobalContext' do
end
 
it 'namespace name should be searchable' do
context = Search::GlobalContext.new(user, search: "searchable namespace")
context = Search::GlobalService.new(user, search: "searchable namespace")
results = context.execute
results[:projects].should == [found_project]
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment