#794: fixes for failed specs

This commit is contained in:
Vokhmin Alexey V 2012-12-20 22:50:55 +04:00
parent c72968ba2a
commit 0ad9932561
7 changed files with 12 additions and 14 deletions

View File

@ -89,4 +89,5 @@ group :test do
gem 'factory_girl_rails', '~> 4.0.0'
gem 'rr', '~> 1.0.4'
gem 'shoulda'
gem 'mock_redis', '0.6.2'
end

View File

@ -175,6 +175,7 @@ GEM
meta-tags (1.2.6)
actionpack
mime-types (1.19)
mock_redis (0.6.2)
multi_json (1.5.0)
mustache (0.99.4)
net-scp (1.0.4)
@ -391,6 +392,7 @@ DEPENDENCIES
jquery-rails (~> 2.0.2)
mailcatcher
meta-tags (~> 1.2.5)
mock_redis (= 0.6.2)
newrelic_rpm (~> 3.4.1)
omniauth (~> 1.1.0)
omniauth-openid (~> 1.0.1)

View File

@ -127,8 +127,8 @@ shared_examples_for 'api repository user with writer rights' do
context 'api repository user with update signatures rights' do
before do
stub_key_pairs_calls
put :signatures, :id => @repository.id, :repository => {:public => 'iampublic', :secret => 'iamsecret'}, :format => :json
kp = FactoryGirl.build(:key_pair)
put :signatures, :id => @repository.id, :repository => {:public => kp.public, :secret => kp.secret}, :format => :json
end
it 'should be able to perform signatures action' do
response.should be_success
@ -228,8 +228,8 @@ shared_examples_for 'api repository user without writer rights' do
context 'api repository user without update signatures rights' do
before do
stub_key_pairs_calls
put :signatures, :id => @repository.id, :repository => {:public => 'iampublic', :secret => 'iamsecret'}, :format => :json
kp = FactoryGirl.build(:key_pair)
put :signatures, :id => @repository.id, :repository => {:public => kp.public, :secret => kp.secret}, :format => :json
end
it 'should not be able to perform signatures action' do
response.should_not be_success

View File

@ -69,17 +69,17 @@ end
describe Platforms::KeyPairsController do
before(:each) do
stub_symlink_methods
stub_key_pairs_calls
@platform = FactoryGirl.create(:platform)
@repository = FactoryGirl.create(:repository, :platform => @platform)
@user = FactoryGirl.create(:user)
kp = FactoryGirl.build(:key_pair)
@create_params = {
:platform_id => @platform,
:key_pair => {
:repository_id => @repository,
:public => "iampublic",
:secret => "iamsecret"
:public => kp.public,
:secret => kp.secret
}
}
end

View File

@ -84,6 +84,8 @@ end
describe Platforms::ProductBuildListsController do
before(:each) do
stub_symlink_methods
redis_instance = MockRedis.new
stub(Redis).new { redis_instance }
end
context 'crud' do

View File

@ -3,7 +3,6 @@ require 'spec_helper'
describe KeyPair do
before(:all) do
stub_symlink_methods
stub_key_pairs_calls
FactoryGirl.create(:key_pair)
end

View File

@ -46,12 +46,6 @@ def stub_symlink_methods
any_instance_of(Platform, :remove_symlink_directory => true)
end
def stub_key_pairs_calls
stub(BuildServer).import_gpg_key_pair { [0,"1a2b3c"] }
stub(BuildServer).set_repository_key { 0 }
stub(BuildServer).rm_repository_key { 0 }
end
Resque.inline = true
def init_test_root