#276: fixed specs

This commit is contained in:
Vokhmin Alexey V 2013-08-26 22:33:23 +04:00
parent f92c91736e
commit ea82e9a01b
1 changed files with 8 additions and 7 deletions

View File

@ -46,7 +46,7 @@ shared_examples_for 'user without change projects in repository rights' do
it 'should not be able to perform regenerate_metadata action' do
put :regenerate_metadata, :id => @repository.id, :platform_id => @platform.id
response.should redirect_to(redirect_path)
regenerate_metadata_queue.should be_empty
@repository.repository_statuses.should have(:no).items
end
it 'should not be able to remove project from repository' do
@ -65,13 +65,13 @@ shared_examples_for 'registered user or guest' do
it 'should not be able to perform regenerate_metadata action' do
put :regenerate_metadata, :id => @repository.id, :platform_id => @platform.id
response.should redirect_to(redirect_path)
regenerate_metadata_queue.should be_empty
@repository.repository_statuses.should have(:no).items
end
it 'should not be able to perform regenerate_metadata action of personal repository' do
put :regenerate_metadata, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id
response.should redirect_to(redirect_path)
regenerate_metadata_queue.should be_empty
@personal_repository.repository_statuses.should have(:no).items
end
it 'should not be able to perform create action' do
@ -157,19 +157,21 @@ shared_examples_for 'platform admin user' do
it 'should be able to perform regenerate_metadata action' do
put :regenerate_metadata, :id => @repository.id, :platform_id => @platform.id
response.should redirect_to(platform_repository_path(@platform, @repository))
regenerate_metadata_queue.should == ["#{@repository.id}-#{@platform.id}"]
@repository.repository_statuses.find_by_platform_id(@platform.id).
waiting_for_regeneration?.should be_true
end
it 'should be able to perform regenerate_metadata action of personal repository' do
put :regenerate_metadata, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id, :build_for_platform_id => @platform.id
response.should redirect_to(platform_repository_path(@personal_repository.platform, @personal_repository))
regenerate_metadata_queue.should == ["#{@personal_repository.id}-#{@platform.id}"]
@personal_repository.repository_statuses.find_by_platform_id(@platform.id).
waiting_for_regeneration?.should be_true
end
it 'should not be able to perform regenerate_metadata action of personal repository when build_for_platform does not exist' do
put :regenerate_metadata, :id => @personal_repository.id, :platform_id => @personal_repository.platform.id
response.should render_template(:file => "#{Rails.root}/public/404.html")
regenerate_metadata_queue.should be_empty
@personal_repository.repository_statuses.should have(:no).items
end
it 'should be able to create repository' do
@ -228,7 +230,6 @@ shared_examples_for 'platform admin user' do
end
describe Platforms::RepositoriesController do
let(:regenerate_metadata_queue) { @redis_instance.lrange(AbfWorker::BuildListsPublishTaskManager::REGENERATE_METADATA, 0, -1) }
before(:each) do
stub_symlink_methods
stub_redis