diff --git a/spec/controllers/api/v1/build_lists_controller_spec.rb b/spec/controllers/api/v1/build_lists_controller_spec.rb index 43da9f1cf..32bdb8f0a 100644 --- a/spec/controllers/api/v1/build_lists_controller_spec.rb +++ b/spec/controllers/api/v1/build_lists_controller_spec.rb @@ -89,10 +89,7 @@ shared_examples_for 'validation error via build list api' do |message| end describe Api::V1::BuildListsController do - before(:each) do - stub_symlink_methods - stub_redis - end + before(:each) { stub_symlink_methods } context 'create and update abilities' do context 'for user' do @@ -183,7 +180,6 @@ describe Api::V1::BuildListsController do put :create_container, id: @build_list, format: :json end - before { stub_redis } context 'if user is project owner' do before do http_login(@owner_user) diff --git a/spec/controllers/api/v1/issues_controller_spec.rb b/spec/controllers/api/v1/issues_controller_spec.rb index 4d771d8d4..6f04c973c 100644 --- a/spec/controllers/api/v1/issues_controller_spec.rb +++ b/spec/controllers/api/v1/issues_controller_spec.rb @@ -3,7 +3,6 @@ require 'spec_helper' describe Api::V1::IssuesController do before(:all) do stub_symlink_methods - stub_redis any_instance_of(Project, versions: ['v1.0', 'v2.0']) @project = FactoryGirl.create(:project_with_commit) diff --git a/spec/controllers/api/v1/product_build_lists_controller.rb b/spec/controllers/api/v1/product_build_lists_controller.rb index 406e9d8e9..35ee395a3 100644 --- a/spec/controllers/api/v1/product_build_lists_controller.rb +++ b/spec/controllers/api/v1/product_build_lists_controller.rb @@ -115,7 +115,6 @@ end describe Api::V1::ProductBuildListsController do before(:each) do stub_symlink_methods - stub_redis @product_build_list = FactoryGirl.create(:product_build_list) @another_user = FactoryGirl.create(:user) diff --git a/spec/controllers/api/v1/products_controller_spec.rb b/spec/controllers/api/v1/products_controller_spec.rb index 15a579509..7528e9450 100644 --- a/spec/controllers/api/v1/products_controller_spec.rb +++ b/spec/controllers/api/v1/products_controller_spec.rb @@ -117,7 +117,6 @@ end describe Api::V1::ProductsController do before(:each) do stub_symlink_methods - stub_redis @product = FactoryGirl.create(:product) @another_user = FactoryGirl.create(:user) diff --git a/spec/controllers/api/v1/pull_requests_controller.rb b/spec/controllers/api/v1/pull_requests_controller.rb index 63f846eb5..5b946d413 100644 --- a/spec/controllers/api/v1/pull_requests_controller.rb +++ b/spec/controllers/api/v1/pull_requests_controller.rb @@ -11,7 +11,7 @@ end describe Api::V1::PullRequestsController do before(:all) do stub_symlink_methods - stub_redis + @project = FactoryGirl.create(:project_with_commit) @pull = create_pull 'master', 'non_conflicts', @project.owner diff --git a/spec/controllers/api/v1/repositories_controller_spec.rb b/spec/controllers/api/v1/repositories_controller_spec.rb index cf927fe8e..5b12f4e45 100644 --- a/spec/controllers/api/v1/repositories_controller_spec.rb +++ b/spec/controllers/api/v1/repositories_controller_spec.rb @@ -301,7 +301,6 @@ end describe Api::V1::RepositoriesController do before(:each) do stub_symlink_methods - stub_redis @platform = FactoryGirl.create(:platform) @repository = FactoryGirl.create(:repository, platform: @platform) diff --git a/spec/controllers/platforms/key_pairs_controller_spec.rb b/spec/controllers/platforms/key_pairs_controller_spec.rb index e6ed0ff74..080852411 100644 --- a/spec/controllers/platforms/key_pairs_controller_spec.rb +++ b/spec/controllers/platforms/key_pairs_controller_spec.rb @@ -69,7 +69,6 @@ end describe Platforms::KeyPairsController do before(:each) do stub_symlink_methods - stub_redis @platform = FactoryGirl.create(:platform) @repository = FactoryGirl.create(:repository, platform: @platform) diff --git a/spec/controllers/platforms/product_build_lists_controller_spec.rb b/spec/controllers/platforms/product_build_lists_controller_spec.rb index 06e3c9a80..80e9b1e6c 100644 --- a/spec/controllers/platforms/product_build_lists_controller_spec.rb +++ b/spec/controllers/platforms/product_build_lists_controller_spec.rb @@ -93,10 +93,7 @@ shared_examples_for 'product build list user' do end describe Platforms::ProductBuildListsController do - before(:each) do - stub_symlink_methods - stub_redis - end + before(:each) { stub_symlink_methods } context 'crud' do diff --git a/spec/controllers/platforms/repositories_controller_spec.rb b/spec/controllers/platforms/repositories_controller_spec.rb index dc7165b33..d433b611c 100644 --- a/spec/controllers/platforms/repositories_controller_spec.rb +++ b/spec/controllers/platforms/repositories_controller_spec.rb @@ -231,7 +231,6 @@ end describe Platforms::RepositoriesController do before(:each) do stub_symlink_methods - stub_redis @platform = FactoryGirl.create(:platform) @repository = FactoryGirl.create(:repository, platform: @platform) diff --git a/spec/controllers/projects/build_lists_controller_spec.rb b/spec/controllers/projects/build_lists_controller_spec.rb index 4e17a4690..032e5b339 100644 --- a/spec/controllers/projects/build_lists_controller_spec.rb +++ b/spec/controllers/projects/build_lists_controller_spec.rb @@ -93,7 +93,6 @@ describe Projects::BuildListsController do build_for_platforms: [@platform.id] } any_instance_of(Project, versions: ['v1.0', 'v2.0']) - stub_redis end context 'for guest' do diff --git a/spec/integration/api_defender_spec.rb b/spec/integration/api_defender_spec.rb index 619fa6ec3..4207cbbac 100644 --- a/spec/integration/api_defender_spec.rb +++ b/spec/integration/api_defender_spec.rb @@ -23,7 +23,7 @@ describe ApiDefender do end before do - stub_symlink_methods && stub_redis + stub_symlink_methods @redis = Redis.new @password = '123456' @rate_limit = 3 # dont forget change in max_per_window diff --git a/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb b/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb index 6a45a4a13..77c02bc80 100644 --- a/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb +++ b/spec/lib/abf-worker/build_lists_publish_task_manager_spec.rb @@ -7,7 +7,6 @@ describe AbfWorker::BuildListsPublishTaskManager do end before do - stub_redis stub_symlink_methods FactoryGirl.create(:build_list) end diff --git a/spec/models/advisory_spec.rb b/spec/models/advisory_spec.rb index 1d718b82e..2f2e6f8ce 100644 --- a/spec/models/advisory_spec.rb +++ b/spec/models/advisory_spec.rb @@ -17,7 +17,7 @@ shared_examples_for 'attach advisory to build_list' do end describe Advisory do - before { stub_symlink_methods; stub_redis } + before { stub_symlink_methods } context 'attach_build_list' do let(:build_list) { FactoryGirl.create(:build_list) } diff --git a/spec/models/build_list/package_spec.rb b/spec/models/build_list/package_spec.rb index 5acf1d0c2..fe71fa974 100644 --- a/spec/models/build_list/package_spec.rb +++ b/spec/models/build_list/package_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe BuildList::Package do - before { stub_symlink_methods; stub_redis } + before { stub_symlink_methods } it 'is valid' do FactoryGirl.create(:build_list_package).should be_persisted diff --git a/spec/models/build_list_spec.rb b/spec/models/build_list_spec.rb index d6ca3a7e0..fa0426f33 100644 --- a/spec/models/build_list_spec.rb +++ b/spec/models/build_list_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe BuildList do - before { stub_symlink_methods; stub_redis } + before { stub_symlink_methods } context 'validates that repository contains project' do it 'when repository contains project' do diff --git a/spec/models/comment_for_commit_spec.rb b/spec/models/comment_for_commit_spec.rb index 8d62928e9..13f89dcbc 100644 --- a/spec/models/comment_for_commit_spec.rb +++ b/spec/models/comment_for_commit_spec.rb @@ -38,7 +38,7 @@ def should_not_send_email(args={}) end describe Comment do - before { stub_symlink_methods; stub_redis } + before { stub_symlink_methods } context 'for global admin user' do before(:each) do @user = FactoryGirl.create(:admin) diff --git a/spec/models/key_pair_spec.rb b/spec/models/key_pair_spec.rb index a4aeadaa1..6bd2e46c4 100644 --- a/spec/models/key_pair_spec.rb +++ b/spec/models/key_pair_spec.rb @@ -1,11 +1,7 @@ require 'spec_helper' describe KeyPair do - before(:all) do - init_test_root - stub_redis - FactoryGirl.create(:key_pair) - end + before(:all) { FactoryGirl.create(:key_pair) } it { should belong_to(:repository) } it { should belong_to(:user)} diff --git a/spec/models/product_build_list_spec.rb b/spec/models/product_build_list_spec.rb index d871ec98d..01f106b41 100644 --- a/spec/models/product_build_list_spec.rb +++ b/spec/models/product_build_list_spec.rb @@ -3,7 +3,6 @@ require 'spec_helper' describe ProductBuildList do before do stub_symlink_methods - stub_redis FactoryGirl.create(:product_build_list) end diff --git a/spec/models/product_spec.rb b/spec/models/product_spec.rb index 1682f8c30..000ff77f3 100644 --- a/spec/models/product_spec.rb +++ b/spec/models/product_spec.rb @@ -30,7 +30,6 @@ describe Product do context 'by autostart_status = once_a_12_hours' do before do stub_symlink_methods - stub_redis params = {main_script: 'text.sh', project_version: product.project.default_branch} product.update_attributes params.merge(autostart_status: Product::ONCE_A_12_HOURS) FactoryGirl.create :product, params.merge(autostart_status: Product::ONCE_A_DAY) diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 55ba5a9be..a3d21aa46 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Project do - before { stub_symlink_methods; stub_redis } + before { stub_symlink_methods } context 'creation' do let(:root_project) { FactoryGirl.create(:project) } diff --git a/spec/models/project_to_repository_spec.rb b/spec/models/project_to_repository_spec.rb index 442197e62..d1d417b9b 100644 --- a/spec/models/project_to_repository_spec.rb +++ b/spec/models/project_to_repository_spec.rb @@ -17,7 +17,6 @@ describe ProjectToRepository do end it 'creates task for removing project from repository on destroy' do - stub_redis @first_repo.project_to_repositories.destroy_all queue = @redis_instance.lrange(AbfWorker::BuildListsPublishTaskManager::PROJECTS_FOR_CLEANUP, 0, -1) queue.should have(2).item diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index e101963a1..85f35df8d 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -123,7 +123,6 @@ describe Repository do end it '#remove_projects' do - stub_redis repository = FactoryGirl.create(:repository) project = FactoryGirl.create(:project) repository.projects << project diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7310c7add..7514ace01 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -29,6 +29,7 @@ RSpec.configure do |config| config.before(:all) { init_test_root } config.after(:all) { clear_test_root } + config.before { stub_redis } end def set_session_for(user=nil)