Fix collaborators controller broken tests

Fix members controller broken tests
Add platforms controllers test
Fix mistake in cancan model test
This commit is contained in:
Vladimir Sharshov 2011-12-15 00:49:33 +04:00
parent b03805bccc
commit 4d42fb67e1
4 changed files with 16 additions and 12 deletions

View File

@ -56,9 +56,10 @@ describe CollaboratorsController do
@project.relations.exists?(:object_type => 'Group', :object_id => @group.id, :role => 'reader').should be_true
end
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'
it_should_behave_like 'show collaborators list'
it_should_behave_like 'update collaborators'
it_should_behave_like 'update collaborator relation'
end
context 'for owner user' do

View File

@ -4,6 +4,7 @@ describe MembersController do
before(:each) do
@group = Factory(:group)
@user = @group.owner
set_session_for @user
@another_user = Factory(:user)
@add_params = {:group_id => @group.id, :user_id => @another_user.uname}
end
@ -11,13 +12,13 @@ describe MembersController do
context 'for owner user' do
it 'should add member to group' do
post :add, @add_params
response.should redirect_to(:edit)
response.should redirect_to(edit_group_members_path(@group))
Relation.by_target(@group).by_object(@another_user).count.should eql(1)
end
it 'should add reader member to group' do
post :add, @add_params
Relation.by_target(@group).by_object(@another_user).role.should eql('reader')
Relation.by_target(@group).by_object(@another_user).first.role.should eql('reader')
end
end
end

View File

@ -64,13 +64,15 @@ describe PlatformsController do
it_should_behave_like 'change_objects_count_on_destroy_success'
it_should_behave_like 'not_be_able_to_destroy_personal_platform'
context 'when owner uname present' do
it 'should create platform with mentioned owner' do
post :create, @create_params.merge({:admin_uname => @user.uname})
Platform.last.owner.id.should eql(@user.id)
end
it 'should create platform with mentioned owner if owner id present' do
post :create, @create_params.merge({:admin_id => @user.id})
Platform.last.owner.id.should eql(@user.id)
end
it 'should create platform with current user as owner if owner id not present' do
post :create, @create_params
Platform.last.owner.id.should eql(@admin.id)
end
end

View File

@ -213,7 +213,7 @@ describe CanCan do
end
[:manage, :add_project, :remove_project, :change_visibility, :settings].each do |action|
it 'should be able to #{ action } repository' do
it "should be able to #{ action } repository" do
@ability.should be_able_to(action, @repository)
end
end