[refs #263] Fix most of the failed tests

This commit is contained in:
konstantin.grabar 2012-03-22 19:48:28 +04:00
parent 385bd8034b
commit 16c9e6aa24
7 changed files with 20 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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