[#345] add global stub redis

This commit is contained in:
Alexander Machehin 2014-03-18 19:54:16 +06:00
parent 1cd0b182d6
commit 62c290dd0d
23 changed files with 11 additions and 33 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -7,7 +7,6 @@ describe AbfWorker::BuildListsPublishTaskManager do
end
before do
stub_redis
stub_symlink_methods
FactoryGirl.create(:build_list)
end

View File

@ -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) }

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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)}

View File

@ -3,7 +3,6 @@ require 'spec_helper'
describe ProductBuildList do
before do
stub_symlink_methods
stub_redis
FactoryGirl.create(:product_build_list)
end

View File

@ -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)

View File

@ -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) }

View File

@ -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

View File

@ -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

View File

@ -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)