[#345] fix stubbing redis

This commit is contained in:
Alexander Machehin 2014-03-18 17:02:33 +06:00
parent 83010eca32
commit e1a6cb767f
6 changed files with 7 additions and 8 deletions

View File

@ -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 } before { stub_symlink_methods; stub_redis }
context 'attach_build_list' do context 'attach_build_list' do
let(:build_list) { FactoryGirl.create(:build_list) } let(:build_list) { FactoryGirl.create(:build_list) }

View File

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe BuildList::Package do describe BuildList::Package do
before { stub_symlink_methods } before { stub_symlink_methods; stub_redis }
it 'is valid' do it 'is valid' do
FactoryGirl.create(:build_list_package).should be_persisted FactoryGirl.create(:build_list_package).should be_persisted

View File

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe BuildList do describe BuildList do
before { stub_symlink_methods } before { stub_symlink_methods; stub_redis }
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

View File

@ -38,7 +38,7 @@ def should_not_send_email(args={})
end end
describe Comment do describe Comment do
before { stub_symlink_methods } before { stub_symlink_methods; stub_redis }
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)

View File

@ -1,7 +1,7 @@
require 'spec_helper' require 'spec_helper'
describe Project do describe Project do
before { stub_symlink_methods } before { stub_symlink_methods; stub_redis }
context 'creation' do context 'creation' do
let(:root_project) { FactoryGirl.create(:project) } let(:root_project) { FactoryGirl.create(:project) }
@ -102,7 +102,6 @@ describe Project do
let(:branch) { project.repo.branches.detect{|b| b.name == 'conflicts'} } let(:branch) { project.repo.branches.detect{|b| b.name == 'conflicts'} }
let(:master) { project.repo.branches.detect{|b| b.name == 'master'} } let(:master) { project.repo.branches.detect{|b| b.name == 'master'} }
let(:user) { FactoryGirl.create(:user) } let(:user) { FactoryGirl.create(:user) }
before { stub_redis }
context '#delete_branch' do context '#delete_branch' do
it 'ensures that returns true on success' do it 'ensures that returns true on success' do

View File

@ -64,8 +64,8 @@ end
def stub_redis def stub_redis
@redis_instance = MockRedis.new @redis_instance = MockRedis.new
allow(Redis).to receive(:new).and_return(@redis_instance) Redis.stub(:new).and_return { @redis_instance }
allow(Resque).to receive(:redis).and_return(@redis_instance) Redis::Store.stub(:new).and_return { @redis_instance }
end end
def fill_project project def fill_project project