[refs #2249] Fix some specs. Fix shared examples. Fix new/create repositories and products ability
This commit is contained in:
parent
18b9f7c51e
commit
fc4643ce9b
|
@ -2,6 +2,7 @@ class ProductsController < ApplicationController
|
|||
before_filter :authenticate_user!
|
||||
before_filter :find_product, :only => [:show, :edit, :update, :destroy]
|
||||
before_filter :find_platform
|
||||
before_filter :build_product_stub, :only => [:new, :create]
|
||||
|
||||
load_and_authorize_resource :platform
|
||||
load_and_authorize_resource :product, :through => :platform
|
||||
|
@ -64,4 +65,8 @@ class ProductsController < ApplicationController
|
|||
def find_platform
|
||||
@platform = Platform.find params[:platform_id]
|
||||
end
|
||||
|
||||
def build_product_stub
|
||||
@product = Product.new(:platform_id => params[:platform_id])
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,6 +4,7 @@ class RepositoriesController < ApplicationController
|
|||
before_filter :find_platform, :only => [:show, :destroy, :add_project, :remove_project]
|
||||
before_filter :get_paths, :only => [:show, :new, :create, :add_project, :remove_project]
|
||||
before_filter :find_platforms, :only => [:new, :create]
|
||||
before_filter :build_repository_stub, :only => [:new, :create]
|
||||
|
||||
load_and_authorize_resource :platform
|
||||
load_and_authorize_resource :repository, :through => :platform, :shallow => true
|
||||
|
@ -109,4 +110,8 @@ class RepositoriesController < ApplicationController
|
|||
def find_repository
|
||||
@repository = Repository.find(params[:id])
|
||||
end
|
||||
|
||||
def build_repository_stub
|
||||
@repository = Repository.build_stub(Platform.find(params[:platform_id]))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require 'shared_examples/collaborators_controller'
|
||||
#require 'shared_examples/collaborators_controller'
|
||||
|
||||
describe CollaboratorsController do
|
||||
before(:each) do
|
||||
|
@ -26,8 +26,8 @@ describe CollaboratorsController do
|
|||
set_session_for(@admin)
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_update_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#collaborators'
|
||||
it_should_behave_like 'be_able_to_perform_update#collaborators'
|
||||
it_should_behave_like 'update_collaborator_relation'
|
||||
end
|
||||
|
||||
|
@ -40,8 +40,8 @@ describe CollaboratorsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_update_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#collaborators'
|
||||
it_should_behave_like 'be_able_to_perform_update#collaborators'
|
||||
it_should_behave_like 'update_collaborator_relation'
|
||||
end
|
||||
|
||||
|
@ -54,8 +54,8 @@ describe CollaboratorsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_update_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#collaborators'
|
||||
it_should_behave_like 'be_able_to_perform_update#collaborators'
|
||||
it_should_behave_like 'update_collaborator_relation'
|
||||
end
|
||||
|
||||
|
@ -68,8 +68,8 @@ describe CollaboratorsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'not_be_able_to_perform_index_action'
|
||||
it_should_behave_like 'not_be_able_to_perform_update_action'
|
||||
it_should_behave_like 'not_be_able_to_perform_index#collaborators'
|
||||
it_should_behave_like 'not_be_able_to_perform_update#collaborators'
|
||||
it_should_behave_like 'not_update_collaborator_relation'
|
||||
end
|
||||
|
||||
|
@ -82,8 +82,8 @@ describe CollaboratorsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'not_be_able_to_perform_index_action'
|
||||
it_should_behave_like 'not_be_able_to_perform_update_action'
|
||||
it_should_behave_like 'not_be_able_to_perform_index#collaborators'
|
||||
it_should_behave_like 'not_be_able_to_perform_update#collaborators'
|
||||
it_should_behave_like 'not_update_collaborator_relation'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require 'shared_examples/personal_repositories_controller'
|
||||
#require 'shared_examples/personal_repositories_controller'
|
||||
|
||||
describe PersonalRepositoriesController do
|
||||
before(:each) do
|
||||
|
@ -25,13 +25,13 @@ describe PersonalRepositoriesController do
|
|||
set_session_for(@admin)
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_show_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action_with_project_id_param'
|
||||
it_should_behave_like 'be_able_to_perform_show#personal_repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#personal_repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#personal_repositories_with_project_id_param'
|
||||
it_should_behave_like 'add_project_to_repository'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project#personal_repositories'
|
||||
it_should_behave_like 'remove_project_from_repository'
|
||||
it_should_behave_like 'be_able_to_perform_settings_action'
|
||||
it_should_behave_like 'be_able_to_perform_settings#personal_repositories'
|
||||
it_should_behave_like 'be_able_to_perform_change_visibility'
|
||||
it_should_behave_like 'be_able_to_change_visibility'
|
||||
end
|
||||
|
@ -58,14 +58,14 @@ describe PersonalRepositoriesController do
|
|||
p.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_settings_action'
|
||||
it_should_behave_like 'be_able_to_perform_settings#personal_repositories'
|
||||
it_should_behave_like 'be_able_to_perform_change_visibility'
|
||||
it_should_behave_like 'be_able_to_change_visibility'
|
||||
it_should_behave_like 'be_able_to_perform_show_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action_with_project_id_param'
|
||||
it_should_behave_like 'be_able_to_perform_show#personal_repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#personal_repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#personal_repositories_with_project_id_param'
|
||||
it_should_behave_like 'add_project_to_repository'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project#personal_repositories'
|
||||
it_should_behave_like 'remove_project_from_repository'
|
||||
end
|
||||
|
||||
|
@ -77,7 +77,7 @@ describe PersonalRepositoriesController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_show_action'
|
||||
it_should_behave_like 'be_able_to_perform_show#personal_repositories'
|
||||
|
||||
it 'should not be able to perform add_project action' do
|
||||
get :add_project, :id => @repository.id
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require "shared_examples/platforms_controller"
|
||||
#require "shared_examples/platforms_controller"
|
||||
|
||||
describe PlatformsController do
|
||||
before(:each) do
|
||||
|
@ -41,7 +41,7 @@ describe PlatformsController do
|
|||
set_session_for(@admin)
|
||||
end
|
||||
|
||||
it_should_behave_like 'able_to_perform_index_action'
|
||||
it_should_behave_like 'able_to_perform_index#platforms'
|
||||
|
||||
it 'should be able to perform new action' do
|
||||
get :new
|
||||
|
@ -57,7 +57,7 @@ describe PlatformsController do
|
|||
lambda { post :create, @create_params }.should change{ Platform.count }.by(1)
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_destroy_action'
|
||||
it_should_behave_like 'be_able_to_perform_destroy#platforms'
|
||||
it_should_behave_like 'change_objects_count_on_destroy_success'
|
||||
it_should_behave_like 'not_be_able_to_destroy_personal_platform'
|
||||
end
|
||||
|
@ -71,9 +71,9 @@ describe PlatformsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'able_to_perform_index_action'
|
||||
it_should_behave_like 'not_be_able_to_perform_create_action'
|
||||
it_should_behave_like 'be_able_to_perform_destroy_action'
|
||||
it_should_behave_like 'able_to_perform_index#platforms'
|
||||
it_should_behave_like 'not_be_able_to_perform_create#platforms'
|
||||
it_should_behave_like 'be_able_to_perform_destroy#platforms'
|
||||
it_should_behave_like 'change_objects_count_on_destroy_success'
|
||||
it_should_behave_like 'not_be_able_to_destroy_personal_platform'
|
||||
|
||||
|
@ -97,8 +97,8 @@ describe PlatformsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'able_to_perform_index_action'
|
||||
it_should_behave_like 'not_be_able_to_perform_create_action'
|
||||
it_should_behave_like 'able_to_perform_index#platforms'
|
||||
it_should_behave_like 'not_be_able_to_perform_create#platforms'
|
||||
|
||||
it 'should not be able to perform destroy action' do
|
||||
delete :destroy, :id => @platform.id
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require 'shared_examples/projects_controller'
|
||||
#require 'shared_examples/projects_controller'
|
||||
|
||||
describe ProjectsController do
|
||||
before(:each) do
|
||||
|
@ -37,8 +37,8 @@ describe ProjectsController do
|
|||
set_session_for(@admin)
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_update_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#projects'
|
||||
it_should_behave_like 'be_able_to_perform_update#projects'
|
||||
it_should_behave_like 'update_collaborator_relation'
|
||||
|
||||
it 'should be able to perform create action' do
|
||||
|
@ -62,10 +62,10 @@ describe ProjectsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_update_action'
|
||||
it_should_behave_like 'be_able_to_perform_update#projects'
|
||||
it_should_behave_like 'update_collaborator_relation'
|
||||
it_should_behave_like 'be_able_to_perform_build_action'
|
||||
it_should_behave_like 'be_able_to_perform_process_build_action'
|
||||
it_should_behave_like 'be_able_to_perform_build#projects'
|
||||
it_should_behave_like 'be_able_to_perform_process_build#projects'
|
||||
|
||||
it 'should be able to perform destroy action' do
|
||||
delete :destroy, {:id => @project.id}
|
||||
|
@ -73,7 +73,7 @@ describe ProjectsController do
|
|||
end
|
||||
|
||||
it 'should change objects count on destroy' do
|
||||
lambda { post :create, @create_params }.should change{ Project.count }.by(-1)
|
||||
lambda { delete :destroy, :id => @project.id }.should change{ Project.count }.by(-1)
|
||||
end
|
||||
|
||||
it 'should not be able to fork project' do
|
||||
|
@ -90,7 +90,7 @@ describe ProjectsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#projects'
|
||||
|
||||
it 'should be able to perform show action' do
|
||||
get :show, :id => @project.id
|
||||
|
@ -108,10 +108,10 @@ describe ProjectsController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_update_action'
|
||||
it_should_behave_like 'be_able_to_perform_update#projects'
|
||||
it_should_behave_like 'update_collaborator_relation'
|
||||
it_should_behave_like 'be_able_to_perform_build_action'
|
||||
it_should_behave_like 'be_able_to_perform_process_build_action'
|
||||
it_should_behave_like 'be_able_to_perform_build#projects'
|
||||
it_should_behave_like 'be_able_to_perform_process_build#projects'
|
||||
it_should_behave_like 'be_able_to_fork_project'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
require 'shared_examples/repositories_controller'
|
||||
#require 'shared_examples/repositories_controller'
|
||||
|
||||
describe RepositoriesController do
|
||||
before(:each) do
|
||||
|
@ -33,11 +33,11 @@ describe RepositoriesController do
|
|||
set_session_for(@admin)
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_show_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#repositories'
|
||||
it_should_behave_like 'be_able_to_perform_show#repositories'
|
||||
|
||||
it 'should be able to perform new action' do
|
||||
get :new
|
||||
get :new, :platform_id => @platform.id
|
||||
response.should render_template(:new)
|
||||
end
|
||||
|
||||
|
@ -50,12 +50,12 @@ describe RepositoriesController do
|
|||
lambda { post :create, @create_params }.should change{ Repository.count }.by(1)
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_destroy_action'
|
||||
it_should_behave_like 'be_able_to_perform_destroy#repositories'
|
||||
it_should_behave_like 'change_repositories_count_after_destroy'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action_with_project_id_param'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#repositories_with_project_id_param'
|
||||
it_should_behave_like 'add_project_to_repository'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project#repositories'
|
||||
it_should_behave_like 'remove_project_from_repository'
|
||||
it_should_behave_like 'not_be_able_to_destroy_personal_repository'
|
||||
end
|
||||
|
@ -67,7 +67,7 @@ describe RepositoriesController do
|
|||
end
|
||||
|
||||
it 'should not be able to perform new action' do
|
||||
get :new
|
||||
get :new, :platform_id => @platform.id
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
|
||||
|
@ -92,14 +92,14 @@ describe RepositoriesController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_show_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action'
|
||||
it_should_behave_like 'be_able_to_perform_add_project_action_with_project_id_param'
|
||||
it_should_behave_like 'be_able_to_perform_index#repositories'
|
||||
it_should_behave_like 'be_able_to_perform_show#repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#repositories'
|
||||
it_should_behave_like 'be_able_to_perform_add_project#repositories_with_project_id_param'
|
||||
it_should_behave_like 'add_project_to_repository'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project'
|
||||
it_should_behave_like 'be_able_to_perform_remove_project#repositories'
|
||||
it_should_behave_like 'remove_project_from_repository'
|
||||
it_should_behave_like 'be_able_to_perform_destroy_action'
|
||||
it_should_behave_like 'be_able_to_perform_destroy#repositories'
|
||||
it_should_behave_like 'change_repositories_count_after_destroy'
|
||||
end
|
||||
|
||||
|
@ -111,8 +111,8 @@ describe RepositoriesController do
|
|||
r.save!
|
||||
end
|
||||
|
||||
it_should_behave_like 'be_able_to_perform_index_action'
|
||||
it_should_behave_like 'be_able_to_perform_show_action'
|
||||
it_should_behave_like 'be_able_to_perform_index#repositories'
|
||||
it_should_behave_like 'be_able_to_perform_show#repositories'
|
||||
|
||||
it 'should not be able to perform add_project action' do
|
||||
get :add_project, :id => @repository.id
|
||||
|
@ -130,4 +130,3 @@ describe RepositoriesController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
shared_examples_for 'be_able_to_perform_index_action' do
|
||||
shared_examples_for 'be_able_to_perform_index#collaborators' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index, :project_id => @project.id
|
||||
response.should redirect_to(edit_project_collaborators_path(@project))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_update_action' do
|
||||
shared_examples_for 'be_able_to_perform_update#collaborators' do
|
||||
it 'should be able to perform update action' do
|
||||
post :update, {:project_id => @project.id}.merge(@update_params)
|
||||
response.should redirect_to(project_path(@project))
|
||||
|
@ -18,14 +18,14 @@ shared_examples_for 'update_collaborator_relation' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'not_be_able_to_perform_index_action' do
|
||||
shared_examples_for 'not_be_able_to_perform_index#collaborators' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index, :project_id => @project.id
|
||||
response.should redirect_to(edit_project_collaborators_path(@project))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'not_be_able_to_perform_update_action' do
|
||||
shared_examples_for 'not_be_able_to_perform_update#collaborators' do
|
||||
it 'should be able to perform update action' do
|
||||
post :update, {:project_id => @project.id}.merge(@update_params)
|
||||
response.should redirect_to(project_path(@project))
|
|
@ -1,58 +1,38 @@
|
|||
shared_examples_for 'be_able_to_perform_show_action' do
|
||||
shared_examples_for 'be_able_to_perform_show#personal_repositories' do
|
||||
it 'should be able to perform show action' do
|
||||
get :show, :id => @repository.id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_add_project_action' do
|
||||
shared_examples_for 'be_able_to_perform_add_project#personal_repositories' do
|
||||
it 'should be able to perform add_project action' do
|
||||
get :add_project, :id => @repository.id
|
||||
response.should render_template(:projects_list)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_add_project_action_with_project_id_param' do
|
||||
shared_examples_for 'be_able_to_perform_add_project#personal_repositories_with_project_id_param' do
|
||||
it 'should be able to perform add_project action with project_id param' do
|
||||
get :add_project, :id => @repository.id, :project_id => @project.id
|
||||
response.should redirect_to(personal_repository_path(@repository))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'add_project_to_repository' do
|
||||
it 'should be able to add project to repository' do
|
||||
get :add_project, :id => @repository.id, :project_id => @project.id
|
||||
@repository.projects.exists? :id => @project.id
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_remove_project' do
|
||||
shared_examples_for 'be_able_to_perform_remove_project#personal_repositories' do
|
||||
it 'should be able to perform remove_project action' do
|
||||
get :remove_project, :id => @repository.id, :project_id => @project.id
|
||||
response.should redirect_to(personal_repository_path(@repository))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'remove_project_from_repository' do
|
||||
it 'should be able to remove project from repository' do
|
||||
get :remove_project, :id => @repository.id, :project_id => @project.id
|
||||
!@repository.projects.exists? :id => @project.id
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_destroy_action' do
|
||||
shared_examples_for 'be_able_to_perform_destroy#personal_repositories' do
|
||||
it 'should be able to perform destroy action' do
|
||||
delete :destroy, :id => @repository.id
|
||||
response.should redirect_to(platform_path(@repository.platform.id))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'change_repositories_count_after_destroy' do
|
||||
it 'should change objects count after destroy action' do
|
||||
lambda { delete :destroy, :id => @repository.id }.should change{ Repository.count }.by(-1)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'not_be_able_to_destroy_personal_repository' do
|
||||
it 'should not be able to destroy personal repository' do
|
||||
delete :destroy, :id => @personal_repository.id
|
||||
|
@ -60,7 +40,7 @@ shared_examples_for 'not_be_able_to_destroy_personal_repository' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_settings_action' do
|
||||
shared_examples_for 'be_able_to_perform_settings#personal_repositories' do
|
||||
it 'should be able to perform settings action' do
|
||||
get :settings, :id => @repository.id
|
||||
response.should render_template(:settings)
|
|
@ -1,11 +1,11 @@
|
|||
shared_examples_for 'able_to_perform_index_action' do
|
||||
shared_examples_for 'able_to_perform_index#platforms' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index
|
||||
response.should render_template(:index)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'not_be_able_to_perform_create_action' do
|
||||
shared_examples_for 'not_be_able_to_perform_create#platforms' do
|
||||
it 'should be able to perform create action' do
|
||||
post :create, @create_params
|
||||
response.should redirect_to(forbidden_path)
|
||||
|
@ -25,7 +25,7 @@ shared_examples_for 'change_objects_count_on_destroy_success' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_destroy_action' do
|
||||
shared_examples_for 'be_able_to_perform_destroy#platforms' do
|
||||
it 'should be able to perform destroy action' do
|
||||
delete :destroy, :id => @platform.id
|
||||
response.should redirect_to(root_path)
|
|
@ -1,23 +1,17 @@
|
|||
shared_examples_for 'be_able_to_perform_index_action' do
|
||||
shared_examples_for 'be_able_to_perform_index#projects' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index
|
||||
response.should render_template(:index)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_update_action' do
|
||||
shared_examples_for 'be_able_to_perform_update#projects' do
|
||||
it 'should be able to perform update action' do
|
||||
put :update, {:project_id => @project.id}.merge(@update_params)
|
||||
put :update, {:id => @project.id}.merge(@update_params)
|
||||
response.should redirect_to(project_path(@project))
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'update_collaborator_relation' do
|
||||
it 'should update collaborator relation' do
|
||||
@another_user.relations.exists? :target_id => @project.id, :target_type => 'Project', :role => 'read'
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_fork_project' do
|
||||
it 'should be able to fork project' do
|
||||
post :fork, :id => @project.id
|
||||
|
@ -25,14 +19,14 @@ shared_examples_for 'be_able_to_fork_project' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_build_action' do
|
||||
shared_examples_for 'be_able_to_perform_build#projects' do
|
||||
it 'should be able to perform build action' do
|
||||
get :build, :id => @project.id
|
||||
response.should render_template(:build)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_process_build_action' do
|
||||
shared_examples_for 'be_able_to_perform_process_build#projects' do
|
||||
it 'should be able to perform process_build action' do
|
||||
post :process_build, {:id => @project.id}.merge(@process_build_params)
|
||||
response.should redirect_to(project_path(@project))
|
|
@ -1,25 +1,25 @@
|
|||
shared_examples_for 'be_able_to_perform_index_action' do
|
||||
shared_examples_for 'be_able_to_perform_index#repositories' do
|
||||
it 'should be able to perform index action' do
|
||||
get :index
|
||||
response.should render_template(:index)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_show_action' do
|
||||
shared_examples_for 'be_able_to_perform_show#repositories' do
|
||||
it 'should be able to perform show action' do
|
||||
get :show, :id => @repository.id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_add_project_action' do
|
||||
shared_examples_for 'be_able_to_perform_add_project#repositories' do
|
||||
it 'should be able to perform add_project action' do
|
||||
get :add_project, :id => @repository.id
|
||||
response.should render_template(:projects_list)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_add_project_action_with_project_id_param' do
|
||||
shared_examples_for 'be_able_to_perform_add_project#repositories_with_project_id_param' do
|
||||
it 'should be able to perform add_project action with project_id param' do
|
||||
get :add_project, :id => @repository.id, :project_id => @project.id
|
||||
response.should redirect_to(repository_path(@repository))
|
||||
|
@ -33,7 +33,7 @@ shared_examples_for 'add_project_to_repository' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_remove_project' do
|
||||
shared_examples_for 'be_able_to_perform_remove_project#repositories' do
|
||||
it 'should be able to perform remove_project action' do
|
||||
get :remove_project, :id => @repository.id, :project_id => @project.id
|
||||
response.should redirect_to(repository_path(@repository))
|
||||
|
@ -47,7 +47,7 @@ shared_examples_for 'remove_project_from_repository' do
|
|||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'be_able_to_perform_destroy_action' do
|
||||
shared_examples_for 'be_able_to_perform_destroy#repositories' do
|
||||
it 'should be able to perform destroy action' do
|
||||
delete :destroy, :id => @repository.id
|
||||
response.should redirect_to(platform_path(@repository.platform.id))
|
||||
|
@ -59,10 +59,3 @@ shared_examples_for 'change_repositories_count_after_destroy' do
|
|||
lambda { delete :destroy, :id => @repository.id }.should change{ Repository.count }.by(-1)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'not_be_able_to_destroy_personal_repository' do
|
||||
it 'should not be able to destroy personal repository' do
|
||||
delete :destroy, :id => @personal_repository.id
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue