diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index 7e3e29f59fb161e4486d458d5d5f8f074327d0ed..ea20595047cf964b3c33c8bf2a8446ac42832674 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -19,7 +19,7 @@ class Admin::ProjectsController < Admin::ApplicationController end def transfer - result = ::Projects::TransferContext.new(@project, current_user, project: params).execute(:admin) + result = ::Projects::TransferService.new(@project, current_user, project: params).execute(:admin) if result redirect_to [:admin, @project] diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index fc9807e3c4757023ca876d28bfc1a990271295a3..2aa73471e2b73fef1840384144b756596acec25b 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -13,7 +13,7 @@ class Projects::BlobController < Projects::ApplicationController end def destroy - result = Files::DeleteContext.new(@project, current_user, params, @ref, @path).execute + result = Files::DeleteService.new(@project, current_user, params, @ref, @path).execute if result[:status] == :success flash[:notice] = "Your changes have been successfully committed" diff --git a/app/controllers/projects/edit_tree_controller.rb b/app/controllers/projects/edit_tree_controller.rb index 3921273620cc15b0cf44950737d26b31e1d6d450..aa4631300e0533f816e483b2f68d8250fcc4b1f3 100644 --- a/app/controllers/projects/edit_tree_controller.rb +++ b/app/controllers/projects/edit_tree_controller.rb @@ -7,7 +7,7 @@ class Projects::EditTreeController < Projects::BaseTreeController end def update - result = Files::UpdateContext.new(@project, current_user, params, @ref, @path).execute + result = Files::UpdateService.new(@project, current_user, params, @ref, @path).execute if result[:status] == :success flash[:notice] = "Your changes have been successfully committed" diff --git a/app/controllers/projects/issues_controller.rb b/app/controllers/projects/issues_controller.rb index 83ff968c70fb9734c90cd3d6ca38356e3e8fc40e..770fccaa11b6dcd22bdd2fd27b9ad09192f3505e 100644 --- a/app/controllers/projects/issues_controller.rb +++ b/app/controllers/projects/issues_controller.rb @@ -89,7 +89,7 @@ class Projects::IssuesController < Projects::ApplicationController end def bulk_update - result = Issues::BulkUpdateContext.new(project, current_user, params).execute + result = Issues::BulkUpdateService.new(project, current_user, params).execute redirect_to :back, notice: "#{result[:count]} issues updated" end diff --git a/app/controllers/projects/new_tree_controller.rb b/app/controllers/projects/new_tree_controller.rb index 933a0cb876e0dcdde769077c934c428d8aaa3332..2f3647ab071cab7f16844bd341d7310ae33297e8 100644 --- a/app/controllers/projects/new_tree_controller.rb +++ b/app/controllers/projects/new_tree_controller.rb @@ -6,7 +6,7 @@ class Projects::NewTreeController < Projects::BaseTreeController def update file_path = File.join(@path, File.basename(params[:file_name])) - result = Files::CreateContext.new(@project, current_user, params, @ref, file_path).execute + result = Files::CreateService.new(@project, current_user, params, @ref, file_path).execute if result[:status] == :success flash[:notice] = "Your changes have been successfully committed" diff --git a/app/controllers/projects/notes_controller.rb b/app/controllers/projects/notes_controller.rb index 261841f1ea23b2d023c41a4dab4c8844b9aa3796..9c9c2decc788e09d1d11755dfdc9e7c4fb03b3d9 100644 --- a/app/controllers/projects/notes_controller.rb +++ b/app/controllers/projects/notes_controller.rb @@ -5,7 +5,7 @@ class Projects::NotesController < Projects::ApplicationController before_filter :authorize_admin_note!, only: [:update, :destroy] def index - @notes = Notes::LoadContext.new(project, current_user, params).execute + @notes = Notes::LoadService.new(project, current_user, params).execute notes_json = { notes: [] } @@ -20,7 +20,7 @@ class Projects::NotesController < Projects::ApplicationController end def create - @note = Notes::CreateContext.new(project, current_user, params).execute + @note = Notes::CreateService.new(project, current_user, params).execute respond_to do |format| format.json { render_note_json(@note) } diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index e1c55e7d913f17804681b0283c118164946757c9..6ec109b91452e63adacbbbd9f7c0380a08eba8d3 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -20,7 +20,7 @@ class ProjectsController < ApplicationController end def create - @project = ::Projects::CreateContext.new(current_user, params[:project]).execute + @project = ::Projects::CreateService.new(current_user, params[:project]).execute respond_to do |format| flash[:notice] = 'Project was successfully created.' if @project.saved? @@ -36,7 +36,7 @@ class ProjectsController < ApplicationController end def update - status = ::Projects::UpdateContext.new(@project, current_user, params).execute + status = ::Projects::UpdateService.new(@project, current_user, params).execute respond_to do |format| if status @@ -51,7 +51,7 @@ class ProjectsController < ApplicationController end def transfer - ::Projects::TransferContext.new(project, current_user, params).execute + ::Projects::TransferService.new(project, current_user, params).execute end def show @@ -89,7 +89,7 @@ class ProjectsController < ApplicationController end def fork - @forked_project = ::Projects::ForkContext.new(project, current_user).execute + @forked_project = ::Projects::ForkService.new(project, current_user).execute respond_to do |format| format.html do diff --git a/app/controllers/search_controller.rb b/app/controllers/search_controller.rb index ba8f08c5b8200f472cf0466feac16141112c5222..e853c22800ab43a91ac469921dad273a09588638 100644 --- a/app/controllers/search_controller.rb +++ b/app/controllers/search_controller.rb @@ -5,9 +5,9 @@ class SearchController < ApplicationController if @project return access_denied! unless can?(current_user, :download_code, @project) - @search_results = Search::ProjectContext.new(@project, current_user, params).execute + @search_results = Search::ProjectService.new(@project, current_user, params).execute else - @search_results = Search::GlobalContext.new(current_user, params).execute + @search_results = Search::GlobalService.new(current_user, params).execute end end end diff --git a/app/contexts/base_context.rb b/app/services/base_service.rb similarity index 96% rename from app/contexts/base_context.rb rename to app/services/base_service.rb index 6accd9b2457babe78dde3578095532e1e5971b21..610f04748722a7c729fba28e590531bc204f97f2 100644 --- a/app/contexts/base_context.rb +++ b/app/services/base_service.rb @@ -1,4 +1,4 @@ -class BaseContext +class BaseService attr_accessor :project, :current_user, :params def initialize(project, user, params) diff --git a/app/contexts/files/base_context.rb b/app/services/files/base_service.rb similarity index 92% rename from app/contexts/files/base_context.rb rename to app/services/files/base_service.rb index 44f9826652c37c1ca9f4d7a9cce728acc94d2285..f1765d389767f79c9e41a5b6baf2c926f9081c72 100644 --- a/app/contexts/files/base_context.rb +++ b/app/services/files/base_service.rb @@ -1,5 +1,5 @@ module Files - class BaseContext < ::BaseContext + class BaseService < ::BaseService attr_reader :ref, :path def initialize(project, user, params, ref, path = nil) diff --git a/app/contexts/files/create_context.rb b/app/services/files/create_service.rb similarity index 95% rename from app/contexts/files/create_context.rb rename to app/services/files/create_service.rb index 3b684d3ee92b602f894091106cb659488310251d..185ab26d96b1594634efb5ac01442f10fab0223d 100644 --- a/app/contexts/files/create_context.rb +++ b/app/services/files/create_service.rb @@ -1,7 +1,7 @@ -require_relative "base_context" +require_relative "base_service" module Files - class CreateContext < BaseContext + class CreateService < BaseService def execute allowed = if project.protected_branch?(ref) can?(current_user, :push_code_to_protected_branches, project) diff --git a/app/contexts/files/delete_context.rb b/app/services/files/delete_service.rb similarity index 93% rename from app/contexts/files/delete_context.rb rename to app/services/files/delete_service.rb index 39ff7c2a4b16567e0d0a844fb4aebbb4c2fff68b..30e512d091260fe39c41a0d203bed661cf307a99 100644 --- a/app/contexts/files/delete_context.rb +++ b/app/services/files/delete_service.rb @@ -1,7 +1,7 @@ -require_relative "base_context" +require_relative "base_service" module Files - class DeleteContext < BaseContext + class DeleteService < BaseService def execute allowed = if project.protected_branch?(ref) can?(current_user, :push_code_to_protected_branches, project) diff --git a/app/contexts/files/update_context.rb b/app/services/files/update_service.rb similarity index 93% rename from app/contexts/files/update_context.rb rename to app/services/files/update_service.rb index 8f0185df74d8e69a894b25180c5a4bc1bd4e9671..d59802ae485931bbf82401bf1702be17cb38f31c 100644 --- a/app/contexts/files/update_context.rb +++ b/app/services/files/update_service.rb @@ -1,7 +1,7 @@ -require_relative "base_context" +require_relative "base_service" module Files - class UpdateContext < BaseContext + class UpdateService < BaseService def execute allowed = if project.protected_branch?(ref) can?(current_user, :push_code_to_protected_branches, project) diff --git a/app/contexts/issues/bulk_update_context.rb b/app/services/issues/bulk_update_service.rb similarity index 95% rename from app/contexts/issues/bulk_update_context.rb rename to app/services/issues/bulk_update_service.rb index ab38a4f8ab533d8c40f1b44b8a4ffb7d70cd1b4d..f72a346af6fffc8509c6ac1e7be68fafa98c0960 100644 --- a/app/contexts/issues/bulk_update_context.rb +++ b/app/services/issues/bulk_update_service.rb @@ -1,5 +1,5 @@ module Issues - class BulkUpdateContext < BaseContext + class BulkUpdateService < BaseService def execute update_data = params[:update] diff --git a/app/contexts/notes/create_context.rb b/app/services/notes/create_service.rb similarity index 80% rename from app/contexts/notes/create_context.rb rename to app/services/notes/create_service.rb index 36ea76ff9496cb83dfb3091fe5cbc82848a62796..fb87e175933c4ca321df1f332c734f7a0390cf96 100644 --- a/app/contexts/notes/create_context.rb +++ b/app/services/notes/create_service.rb @@ -1,5 +1,5 @@ module Notes - class CreateContext < BaseContext + class CreateService < BaseService def execute note = project.notes.new(params[:note]) note.author = current_user diff --git a/app/contexts/notes/load_context.rb b/app/services/notes/load_service.rb similarity index 94% rename from app/contexts/notes/load_context.rb rename to app/services/notes/load_service.rb index 234e9ac3cdd375a6a7e6ad92be49c904f643bc0e..f7ad7d60a3a7fc3ea0e7c98879a5d4aaafa11353 100644 --- a/app/contexts/notes/load_context.rb +++ b/app/services/notes/load_service.rb @@ -1,5 +1,5 @@ module Notes - class LoadContext < BaseContext + class LoadService < BaseService def execute target_type = params[:target_type] target_id = params[:target_id] diff --git a/app/contexts/projects/create_context.rb b/app/services/projects/create_service.rb similarity index 98% rename from app/contexts/projects/create_context.rb rename to app/services/projects/create_service.rb index 2acb9fbfe14bbc37bd5cf352827d9daf6f80137b..033be8f9ed6c40bcc951628671a9cc9af093dd4c 100644 --- a/app/contexts/projects/create_context.rb +++ b/app/services/projects/create_service.rb @@ -1,5 +1,5 @@ module Projects - class CreateContext < BaseContext + class CreateService < BaseService def initialize(user, params) @current_user, @params = user, params.dup end diff --git a/app/contexts/projects/fork_context.rb b/app/services/projects/fork_service.rb similarity index 97% rename from app/contexts/projects/fork_context.rb rename to app/services/projects/fork_service.rb index fbc67220d5d2533db6146e26bac65f5336182d05..2f1c7b18aa042840aa0a4746bd040750552aacfd 100644 --- a/app/contexts/projects/fork_context.rb +++ b/app/services/projects/fork_service.rb @@ -1,5 +1,5 @@ module Projects - class ForkContext < BaseContext + class ForkService < BaseService include Gitlab::ShellAdapter def initialize(project, user) diff --git a/app/contexts/projects/transfer_context.rb b/app/services/projects/transfer_service.rb similarity index 94% rename from app/contexts/projects/transfer_context.rb rename to app/services/projects/transfer_service.rb index 3011984e3f8d13f6c58bf255c31151b776301f38..f8e27f6f1c6f9d63a4921b99d9fa5b0fd6f0c7d1 100644 --- a/app/contexts/projects/transfer_context.rb +++ b/app/services/projects/transfer_service.rb @@ -1,5 +1,5 @@ module Projects - class TransferContext < BaseContext + class TransferService < BaseService def execute(role = :default) namespace_id = params[:project].delete(:namespace_id) allowed_transfer = can?(current_user, :change_namespace, project) || role == :admin diff --git a/app/contexts/projects/update_context.rb b/app/services/projects/update_service.rb similarity index 94% rename from app/contexts/projects/update_context.rb rename to app/services/projects/update_service.rb index 94de10de0f6c315d78558e644d192a5ee164ec00..d9d371da5c4376e9c139a7aacdc7cfc1f719ec0f 100644 --- a/app/contexts/projects/update_context.rb +++ b/app/services/projects/update_service.rb @@ -1,5 +1,5 @@ module Projects - class UpdateContext < BaseContext + class UpdateService < BaseService def execute(role = :default) params[:project].delete(:namespace_id) # check that user is allowed to set specified visibility_level diff --git a/app/contexts/search/global_context.rb b/app/services/search/global_service.rb similarity index 98% rename from app/contexts/search/global_context.rb rename to app/services/search/global_service.rb index 74e746018e625674de3579763fe9519ace16cc88..c5ca332236210bba89728c6eaff8741fbe379c2c 100644 --- a/app/contexts/search/global_context.rb +++ b/app/services/search/global_service.rb @@ -1,5 +1,5 @@ module Search - class GlobalContext + class GlobalService attr_accessor :current_user, :params def initialize(user, params) diff --git a/app/contexts/search/project_context.rb b/app/services/search/project_service.rb similarity index 98% rename from app/contexts/search/project_context.rb rename to app/services/search/project_service.rb index 690652b2cdb4410ff603b2a694c8d148a3b93c41..3ebaafc752caf2cf1bd1d7d887f513c8555fe44b 100644 --- a/app/contexts/search/project_context.rb +++ b/app/services/search/project_service.rb @@ -1,5 +1,5 @@ module Search - class ProjectContext + class ProjectService attr_accessor :project, :current_user, :params def initialize(project, user, params) diff --git a/lib/api/files.rb b/lib/api/files.rb index 8e87ae52e645190b002043a4c7ad6df3b07c944b..213604915a69e16786344ea19068d49a15b062f0 100644 --- a/lib/api/files.rb +++ b/lib/api/files.rb @@ -21,7 +21,7 @@ module API attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message, :encoding] branch_name = attrs.delete(:branch_name) file_path = attrs.delete(:file_path) - result = ::Files::CreateContext.new(user_project, current_user, attrs, branch_name, file_path).execute + result = ::Files::CreateService.new(user_project, current_user, attrs, branch_name, file_path).execute if result[:status] == :success status(201) @@ -51,7 +51,7 @@ module API attrs = attributes_for_keys [:file_path, :branch_name, :content, :commit_message, :encoding] branch_name = attrs.delete(:branch_name) file_path = attrs.delete(:file_path) - result = ::Files::UpdateContext.new(user_project, current_user, attrs, branch_name, file_path).execute + result = ::Files::UpdateService.new(user_project, current_user, attrs, branch_name, file_path).execute if result[:status] == :success status(200) @@ -81,7 +81,7 @@ module API attrs = attributes_for_keys [:file_path, :branch_name, :commit_message] branch_name = attrs.delete(:branch_name) file_path = attrs.delete(:file_path) - result = ::Files::DeleteContext.new(user_project, current_user, attrs, branch_name, file_path).execute + result = ::Files::DeleteService.new(user_project, current_user, attrs, branch_name, file_path).execute if result[:status] == :success status(200) diff --git a/lib/api/projects.rb b/lib/api/projects.rb index 66e0d1ba3ef732eaba47590317b4f5d1e7cdfb9b..a4c8f7fc87e941db4a6593d6d4aaa96812814452 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -102,7 +102,7 @@ module API :visibility_level, :import_url] attrs = map_public_to_visibility_level(attrs) - @project = ::Projects::CreateContext.new(current_user, attrs).execute + @project = ::Projects::CreateService.new(current_user, attrs).execute if @project.saved? present @project, with: Entities::Project else @@ -143,7 +143,7 @@ module API :public, :visibility_level] attrs = map_public_to_visibility_level(attrs) - @project = ::Projects::CreateContext.new(user, attrs).execute + @project = ::Projects::CreateService.new(user, attrs).execute if @project.saved? present @project, with: Entities::Project else diff --git a/lib/tasks/gitlab/import.rake b/lib/tasks/gitlab/import.rake index 8fa8927085493f919535d79c5a12791f55d40651..83e941adcb18476a5efba5df44254cd38946544e 100644 --- a/lib/tasks/gitlab/import.rake +++ b/lib/tasks/gitlab/import.rake @@ -66,7 +66,7 @@ namespace :gitlab do project_params[:namespace_id] = group.id end - project = Projects::CreateContext.new(user, project_params).execute + project = Projects::CreateService.new(user, project_params).execute if project.valid? puts " * Created #{project.name} (#{repo_path})".green diff --git a/spec/models/forked_project_link_spec.rb b/spec/models/forked_project_link_spec.rb index 472ddf1b59d8f8925ee2467c631d3c7ea3d95450..e719e3bfcc831d3e5c9342157e5a23fab2b3d3a6 100644 --- a/spec/models/forked_project_link_spec.rb +++ b/spec/models/forked_project_link_spec.rb @@ -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) diff --git a/spec/contexts/fork_context_spec.rb b/spec/services/fork_service_spec.rb similarity index 94% rename from spec/contexts/fork_context_spec.rb rename to spec/services/fork_service_spec.rb index 70f650bc83d94c0aa451d8fefc4843f663dfff8b..b6573095dbd2a06746d6c2ee00d3296218dbdd4d 100644 --- a/spec/contexts/fork_context_spec.rb +++ b/spec/services/fork_service_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Projects::ForkContext do +describe Projects::ForkService do describe :fork_by_user do before do @from_namespace = create(:namespace) @@ -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) diff --git a/spec/contexts/issues/bulk_update_context_spec.rb b/spec/services/issues/bulk_update_context_spec.rb similarity index 85% rename from spec/contexts/issues/bulk_update_context_spec.rb rename to spec/services/issues/bulk_update_context_spec.rb index 058e43ba0905accdbdfc24b69cc6d200ff53a53a..548109a845030c7d651c0b024fbe3d1a0c890abc 100644 --- a/spec/contexts/issues/bulk_update_context_spec.rb +++ b/spec/services/issues/bulk_update_context_spec.rb @@ -1,6 +1,6 @@ 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) } @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/spec/contexts/projects_create_context_spec.rb b/spec/services/projects_create_service_spec.rb similarity index 98% rename from spec/contexts/projects_create_context_spec.rb rename to spec/services/projects_create_service_spec.rb index d5b1cb83510566f9b51056323fdeb947a36bf463..0a41832a2111ebf88fac9fd212d8eb0b2da19cc3 100644 --- a/spec/contexts/projects_create_context_spec.rb +++ b/spec/services/projects_create_service_spec.rb @@ -1,6 +1,6 @@ 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) } @@ -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 diff --git a/spec/contexts/projects_update_context_spec.rb b/spec/services/projects_update_service_spec.rb similarity index 97% rename from spec/contexts/projects_update_context_spec.rb rename to spec/services/projects_update_service_spec.rb index edcaf844e5db61683712c86eef856abe2d939a97..1854c0d82339e9df02f3eac242fd8e7e1ef92fef 100644 --- a/spec/contexts/projects_update_context_spec.rb +++ b/spec/services/projects_update_service_spec.rb @@ -1,6 +1,6 @@ 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) } @@ -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 diff --git a/spec/contexts/search_context_spec.rb b/spec/services/search_service_spec.rb similarity index 89% rename from spec/contexts/search_context_spec.rb rename to spec/services/search_service_spec.rb index 38a6b55383a9a914ae6bee98fd5079850a9107a5..457cb3c0ca36a958e740c818620c63cdd0306378 100644 --- a/spec/contexts/search_context_spec.rb +++ b/spec/services/search_service_spec.rb @@ -1,6 +1,6 @@ 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) } @@ -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) @@ -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) @@ -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) @@ -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