diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 04f77ab7f..01a0d8ddf 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -5,7 +5,6 @@ class ProjectsController < ApplicationController def index @projects = current_user.projects.paginate(:page => params[:page]) -    #@projects = @projects.search(params[:query]).search_order if params[:query] end def new diff --git a/spec/controllers/collaborators_controller_spec.rb b/spec/controllers/collaborators_controller_spec.rb index 858bd3c05..02383d998 100644 --- a/spec/controllers/collaborators_controller_spec.rb +++ b/spec/controllers/collaborators_controller_spec.rb @@ -9,7 +9,7 @@ shared_examples_for 'project admin user' 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)) + response.should redirect_to(edit_project_collaborators_path(@project)) end it 'should be able to set reader role for any user' do @@ -26,7 +26,7 @@ shared_examples_for 'user with no rights for this project' do it 'should not be able to perform update action' do post :update, {:project_id => @project.id}.merge(@update_params) - response.should redirect_to(project_path(@project)) + response.should redirect_to(edit_project_collaborators_path(@project)) end it 'should not be able to set reader role for any user' do @@ -40,7 +40,7 @@ describe CollaboratorsController do stub_rsync_methods @project = Factory(:project) @another_user = Factory(:user) - @update_params = {:user => {:read => {@another_user.id => '1'}}} + @update_params = {:user => {@another_user.id => :reader}} end context 'for guest' do diff --git a/spec/controllers/platforms_controller_spec.rb b/spec/controllers/platforms_controller_spec.rb index 1f42bcdc1..2514fe136 100644 --- a/spec/controllers/platforms_controller_spec.rb +++ b/spec/controllers/platforms_controller_spec.rb @@ -15,7 +15,7 @@ shared_examples_for 'platform owner' do it 'should be able to perform destroy action' do delete :destroy, :id => @platform.id - response.should redirect_to(root_path) + response.should redirect_to(platforms_path) end end @@ -61,7 +61,7 @@ describe PlatformsController do end end - [:show, :new, :edit, :freeze, :unfreeze, :clone, :destroy].each do |action| + [:show, :new, :edit, :clone, :destroy].each do |action| it "should not be able to perform #{ action } action" do get action, :id => @platform response.should redirect_to(new_user_session_path) diff --git a/spec/controllers/products_controller_spec.rb b/spec/controllers/products_controller_spec.rb index 7184e039c..6f57b2b45 100644 --- a/spec/controllers/products_controller_spec.rb +++ b/spec/controllers/products_controller_spec.rb @@ -36,7 +36,7 @@ describe ProductsController do it 'should be able to perform create action' do post :create, @create_params - response.should redirect_to(platform_path( Product.last.platform.id )) + response.should redirect_to(platform_product_path( Product.last.platform.id, Product.last )) end it 'should change objects count on create' do @@ -54,7 +54,7 @@ describe ProductsController do it 'should be able to perform destroy action' do delete :destroy, :platform_id => @platform.id, :id => @product.id - response.should redirect_to(platform_path(@platform)) + response.should redirect_to(platform_products_path(@platform)) end end @@ -67,7 +67,7 @@ describe ProductsController do it 'should be able to perform create action' do post :create, @create_params - response.should redirect_to(platform_path( Product.last.platform.id )) + response.should redirect_to(platform_product_path( Product.last.platform.id, Product.last )) end it 'should change objects count on create' do @@ -85,7 +85,7 @@ describe ProductsController do it 'should be able to perform destroy action' do delete :destroy, :platform_id => @platform.id, :id => @product.id - response.should redirect_to(platform_path(@platform)) + response.should redirect_to(platform_products_path(@platform)) end end diff --git a/spec/models/comment_for_commit_spec.rb b/spec/models/comment_for_commit_spec.rb index d2b6a61da..66c17ec05 100644 --- a/spec/models/comment_for_commit_spec.rb +++ b/spec/models/comment_for_commit_spec.rb @@ -9,8 +9,13 @@ def set_comments_data_for_commit %x(cp -Rf #{Rails.root}/spec/tests.git/* #{@project.git_repository.path}) # maybe FIXME ? @commit = @project.git_repository.commits.first - @comment = Factory(:comment, :user => @user) - @comment.update_attributes(:commentable_type => @commit.class.name, :commentable_id => @commit.id) + #@comment = Factory(:comment, :user => @user, :commentable_type => @commit.class.name, :commentable_id => @commit.id, :project => @project) + @comment = Factory.build(:comment, :user => @user, :project => @project) + @comment.commentable_type = @commit.class.name + @comment.commentable_id = @commit.id.hex + puts @comment.inspect + @comment.save + #@comment.update_attributes(:commentable_type => @commit.class.name, :commentable_id => @commit.id) @stranger_comment = Factory(:comment, :user => @stranger) @stranger_comment.update_attributes(:commentable_type => @commit.class.name, :commentable_id => @commit.id, :project => @project) diff --git a/spec/support/shared_examples/personal_repositories_controller.rb b/spec/support/shared_examples/personal_repositories_controller.rb index 7830abab2..d3aa5c969 100644 --- a/spec/support/shared_examples/personal_repositories_controller.rb +++ b/spec/support/shared_examples/personal_repositories_controller.rb @@ -9,6 +9,6 @@ end shared_examples_for 'destroy personal repository' do it 'should be able to perform destroy action' do delete :destroy, :id => @repository.id - response.should redirect_to(platform_path(@repository.platform.id)) + response.should redirect_to(platform_repositories_path(@repository.platform.id)) end end diff --git a/spec/support/shared_examples/repositories_controller.rb b/spec/support/shared_examples/repositories_controller.rb index 5debef465..adb222544 100644 --- a/spec/support/shared_examples/repositories_controller.rb +++ b/spec/support/shared_examples/repositories_controller.rb @@ -19,21 +19,21 @@ shared_examples_for 'repository user with owner rights' 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)) + response.should redirect_to(platform_repository_path(@repository.platform, @repository)) end it_should_behave_like 'repository user with add project rights' 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)) + response.should redirect_to(platform_repository_path(@repository.platform, @repository)) end it_should_behave_like 'repository user with remove project rights' it 'should be able to perform destroy action' do delete :destroy, :id => @repository.id - response.should redirect_to(platform_path(@repository.platform.id)) + response.should redirect_to(platform_repositories_path(@repository.platform)) end it 'should change objects count after destroy action' do