[#345] add global stub redis
This commit is contained in:
parent
1cd0b182d6
commit
62c290dd0d
|
@ -89,10 +89,7 @@ shared_examples_for 'validation error via build list api' do |message|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Api::V1::BuildListsController do
|
describe Api::V1::BuildListsController do
|
||||||
before(:each) do
|
before(:each) { stub_symlink_methods }
|
||||||
stub_symlink_methods
|
|
||||||
stub_redis
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'create and update abilities' do
|
context 'create and update abilities' do
|
||||||
context 'for user' do
|
context 'for user' do
|
||||||
|
@ -183,7 +180,6 @@ describe Api::V1::BuildListsController do
|
||||||
put :create_container, id: @build_list, format: :json
|
put :create_container, id: @build_list, format: :json
|
||||||
end
|
end
|
||||||
|
|
||||||
before { stub_redis }
|
|
||||||
context 'if user is project owner' do
|
context 'if user is project owner' do
|
||||||
before do
|
before do
|
||||||
http_login(@owner_user)
|
http_login(@owner_user)
|
||||||
|
|
|
@ -3,7 +3,6 @@ require 'spec_helper'
|
||||||
describe Api::V1::IssuesController do
|
describe Api::V1::IssuesController do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||||
|
|
||||||
@project = FactoryGirl.create(:project_with_commit)
|
@project = FactoryGirl.create(:project_with_commit)
|
||||||
|
|
|
@ -115,7 +115,6 @@ end
|
||||||
describe Api::V1::ProductBuildListsController do
|
describe Api::V1::ProductBuildListsController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
|
|
||||||
@product_build_list = FactoryGirl.create(:product_build_list)
|
@product_build_list = FactoryGirl.create(:product_build_list)
|
||||||
@another_user = FactoryGirl.create(:user)
|
@another_user = FactoryGirl.create(:user)
|
||||||
|
|
|
@ -117,7 +117,6 @@ end
|
||||||
describe Api::V1::ProductsController do
|
describe Api::V1::ProductsController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
|
|
||||||
@product = FactoryGirl.create(:product)
|
@product = FactoryGirl.create(:product)
|
||||||
@another_user = FactoryGirl.create(:user)
|
@another_user = FactoryGirl.create(:user)
|
||||||
|
|
|
@ -11,7 +11,7 @@ end
|
||||||
describe Api::V1::PullRequestsController do
|
describe Api::V1::PullRequestsController do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
@project = FactoryGirl.create(:project_with_commit)
|
@project = FactoryGirl.create(:project_with_commit)
|
||||||
@pull = create_pull 'master', 'non_conflicts', @project.owner
|
@pull = create_pull 'master', 'non_conflicts', @project.owner
|
||||||
|
|
||||||
|
|
|
@ -301,7 +301,6 @@ end
|
||||||
describe Api::V1::RepositoriesController do
|
describe Api::V1::RepositoriesController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
|
|
||||||
@platform = FactoryGirl.create(:platform)
|
@platform = FactoryGirl.create(:platform)
|
||||||
@repository = FactoryGirl.create(:repository, platform: @platform)
|
@repository = FactoryGirl.create(:repository, platform: @platform)
|
||||||
|
|
|
@ -69,7 +69,6 @@ end
|
||||||
describe Platforms::KeyPairsController do
|
describe Platforms::KeyPairsController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
|
|
||||||
@platform = FactoryGirl.create(:platform)
|
@platform = FactoryGirl.create(:platform)
|
||||||
@repository = FactoryGirl.create(:repository, platform: @platform)
|
@repository = FactoryGirl.create(:repository, platform: @platform)
|
||||||
|
|
|
@ -93,10 +93,7 @@ shared_examples_for 'product build list user' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Platforms::ProductBuildListsController do
|
describe Platforms::ProductBuildListsController do
|
||||||
before(:each) do
|
before(:each) { stub_symlink_methods }
|
||||||
stub_symlink_methods
|
|
||||||
stub_redis
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'crud' do
|
context 'crud' do
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,6 @@ end
|
||||||
describe Platforms::RepositoriesController do
|
describe Platforms::RepositoriesController do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
|
|
||||||
@platform = FactoryGirl.create(:platform)
|
@platform = FactoryGirl.create(:platform)
|
||||||
@repository = FactoryGirl.create(:repository, platform: @platform)
|
@repository = FactoryGirl.create(:repository, platform: @platform)
|
||||||
|
|
|
@ -93,7 +93,6 @@ describe Projects::BuildListsController do
|
||||||
build_for_platforms: [@platform.id]
|
build_for_platforms: [@platform.id]
|
||||||
}
|
}
|
||||||
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
any_instance_of(Project, versions: ['v1.0', 'v2.0'])
|
||||||
stub_redis
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'for guest' do
|
context 'for guest' do
|
||||||
|
|
|
@ -23,7 +23,7 @@ describe ApiDefender do
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
stub_symlink_methods && stub_redis
|
stub_symlink_methods
|
||||||
@redis = Redis.new
|
@redis = Redis.new
|
||||||
@password = '123456'
|
@password = '123456'
|
||||||
@rate_limit = 3 # dont forget change in max_per_window
|
@rate_limit = 3 # dont forget change in max_per_window
|
||||||
|
|
|
@ -7,7 +7,6 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
stub_redis
|
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
FactoryGirl.create(:build_list)
|
FactoryGirl.create(:build_list)
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,7 @@ shared_examples_for 'attach advisory to build_list' do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Advisory do
|
describe Advisory do
|
||||||
before { stub_symlink_methods; stub_redis }
|
before { stub_symlink_methods }
|
||||||
context 'attach_build_list' do
|
context 'attach_build_list' do
|
||||||
let(:build_list) { FactoryGirl.create(:build_list) }
|
let(:build_list) { FactoryGirl.create(:build_list) }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe BuildList::Package do
|
describe BuildList::Package do
|
||||||
before { stub_symlink_methods; stub_redis }
|
before { stub_symlink_methods }
|
||||||
|
|
||||||
it 'is valid' do
|
it 'is valid' do
|
||||||
FactoryGirl.create(:build_list_package).should be_persisted
|
FactoryGirl.create(:build_list_package).should be_persisted
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe BuildList do
|
describe BuildList do
|
||||||
before { stub_symlink_methods; stub_redis }
|
before { stub_symlink_methods }
|
||||||
|
|
||||||
context 'validates that repository contains project' do
|
context 'validates that repository contains project' do
|
||||||
it 'when repository contains project' do
|
it 'when repository contains project' do
|
||||||
|
|
|
@ -38,7 +38,7 @@ def should_not_send_email(args={})
|
||||||
end
|
end
|
||||||
|
|
||||||
describe Comment do
|
describe Comment do
|
||||||
before { stub_symlink_methods; stub_redis }
|
before { stub_symlink_methods }
|
||||||
context 'for global admin user' do
|
context 'for global admin user' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
@user = FactoryGirl.create(:admin)
|
@user = FactoryGirl.create(:admin)
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe KeyPair do
|
describe KeyPair do
|
||||||
before(:all) do
|
before(:all) { FactoryGirl.create(:key_pair) }
|
||||||
init_test_root
|
|
||||||
stub_redis
|
|
||||||
FactoryGirl.create(:key_pair)
|
|
||||||
end
|
|
||||||
|
|
||||||
it { should belong_to(:repository) }
|
it { should belong_to(:repository) }
|
||||||
it { should belong_to(:user)}
|
it { should belong_to(:user)}
|
||||||
|
|
|
@ -3,7 +3,6 @@ require 'spec_helper'
|
||||||
describe ProductBuildList do
|
describe ProductBuildList do
|
||||||
before do
|
before do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
FactoryGirl.create(:product_build_list)
|
FactoryGirl.create(:product_build_list)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ describe Product do
|
||||||
context 'by autostart_status = once_a_12_hours' do
|
context 'by autostart_status = once_a_12_hours' do
|
||||||
before do
|
before do
|
||||||
stub_symlink_methods
|
stub_symlink_methods
|
||||||
stub_redis
|
|
||||||
params = {main_script: 'text.sh', project_version: product.project.default_branch}
|
params = {main_script: 'text.sh', project_version: product.project.default_branch}
|
||||||
product.update_attributes params.merge(autostart_status: Product::ONCE_A_12_HOURS)
|
product.update_attributes params.merge(autostart_status: Product::ONCE_A_12_HOURS)
|
||||||
FactoryGirl.create :product, params.merge(autostart_status: Product::ONCE_A_DAY)
|
FactoryGirl.create :product, params.merge(autostart_status: Product::ONCE_A_DAY)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Project do
|
describe Project do
|
||||||
before { stub_symlink_methods; stub_redis }
|
before { stub_symlink_methods }
|
||||||
|
|
||||||
context 'creation' do
|
context 'creation' do
|
||||||
let(:root_project) { FactoryGirl.create(:project) }
|
let(:root_project) { FactoryGirl.create(:project) }
|
||||||
|
|
|
@ -17,7 +17,6 @@ describe ProjectToRepository do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'creates task for removing project from repository on destroy' do
|
it 'creates task for removing project from repository on destroy' do
|
||||||
stub_redis
|
|
||||||
@first_repo.project_to_repositories.destroy_all
|
@first_repo.project_to_repositories.destroy_all
|
||||||
queue = @redis_instance.lrange(AbfWorker::BuildListsPublishTaskManager::PROJECTS_FOR_CLEANUP, 0, -1)
|
queue = @redis_instance.lrange(AbfWorker::BuildListsPublishTaskManager::PROJECTS_FOR_CLEANUP, 0, -1)
|
||||||
queue.should have(2).item
|
queue.should have(2).item
|
||||||
|
|
|
@ -123,7 +123,6 @@ describe Repository do
|
||||||
end
|
end
|
||||||
|
|
||||||
it '#remove_projects' do
|
it '#remove_projects' do
|
||||||
stub_redis
|
|
||||||
repository = FactoryGirl.create(:repository)
|
repository = FactoryGirl.create(:repository)
|
||||||
project = FactoryGirl.create(:project)
|
project = FactoryGirl.create(:project)
|
||||||
repository.projects << project
|
repository.projects << project
|
||||||
|
|
|
@ -29,6 +29,7 @@ RSpec.configure do |config|
|
||||||
|
|
||||||
config.before(:all) { init_test_root }
|
config.before(:all) { init_test_root }
|
||||||
config.after(:all) { clear_test_root }
|
config.after(:all) { clear_test_root }
|
||||||
|
config.before { stub_redis }
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_session_for(user=nil)
|
def set_session_for(user=nil)
|
||||||
|
|
Loading…
Reference in New Issue