Merge pull request #330 from warpc/265-activity_feed_messages
[Refs #265, #263] fixed tests to issue comments
This commit is contained in:
commit
57520c6098
|
@ -75,8 +75,8 @@ describe CommentsController do
|
||||||
stub_rsync_methods
|
stub_rsync_methods
|
||||||
|
|
||||||
@project = Factory(:project)
|
@project = Factory(:project)
|
||||||
@issue = Factory(:issue, :project_id => @project.id)
|
@issue = Factory(:issue, :project_id => @project.id, :creator => Factory(:user))
|
||||||
@comment = Factory(:comment, :commentable => @issue)
|
@comment = Factory(:comment, :commentable => @issue, :project_id => @project.id)
|
||||||
|
|
||||||
@create_params = {:comment => {:body => 'I am a comment!'}, :project_id => @project.id, :issue_id => @issue.serial_id}
|
@create_params = {:comment => {:body => 'I am a comment!'}, :project_id => @project.id, :issue_id => @issue.serial_id}
|
||||||
@update_params = {:comment => {:body => 'updated'}, :project_id => @project.id, :issue_id => @issue.serial_id}
|
@update_params = {:comment => {:body => 'updated'}, :project_id => @project.id, :issue_id => @issue.serial_id}
|
||||||
|
@ -92,7 +92,7 @@ describe CommentsController do
|
||||||
set_session_for(@user)
|
set_session_for(@user)
|
||||||
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
||||||
|
|
||||||
@own_comment = Factory(:comment, :commentable => @issue, :user => @user)
|
@own_comment = Factory(:comment, :commentable => @issue, :user => @user, :project_id => @project.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'user with create comment rights'
|
it_should_behave_like 'user with create comment rights'
|
||||||
|
@ -108,7 +108,7 @@ describe CommentsController do
|
||||||
@project.update_attribute(:owner, @user)
|
@project.update_attribute(:owner, @user)
|
||||||
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'admin')
|
||||||
|
|
||||||
@own_comment = Factory(:comment, :commentable => @issue, :user => @user)
|
@own_comment = Factory(:comment, :commentable => @issue, :user => @user, :project_id => @project.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'user with create comment rights'
|
it_should_behave_like 'user with create comment rights'
|
||||||
|
@ -123,7 +123,7 @@ describe CommentsController do
|
||||||
set_session_for(@user)
|
set_session_for(@user)
|
||||||
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'reader')
|
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'reader')
|
||||||
|
|
||||||
@own_comment = Factory(:comment, :commentable => @issue, :user => @user)
|
@own_comment = Factory(:comment, :commentable => @issue, :user => @user, :project_id => @project.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'user with create comment rights'
|
it_should_behave_like 'user with create comment rights'
|
||||||
|
@ -138,7 +138,7 @@ describe CommentsController do
|
||||||
set_session_for(@user)
|
set_session_for(@user)
|
||||||
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'writer')
|
@project.relations.create!(:object_type => 'User', :object_id => @user.id, :role => 'writer')
|
||||||
|
|
||||||
@own_comment = Factory(:comment, :commentable => @issue, :user => @user)
|
@own_comment = Factory(:comment, :commentable => @issue, :user => @user, :project_id => @project.id)
|
||||||
end
|
end
|
||||||
|
|
||||||
it_should_behave_like 'user with create comment rights'
|
it_should_behave_like 'user with create comment rights'
|
||||||
|
|
|
@ -6,10 +6,10 @@ def set_commentable_data
|
||||||
@ability = Ability.new(@user)
|
@ability = Ability.new(@user)
|
||||||
|
|
||||||
@project = Factory(:project)
|
@project = Factory(:project)
|
||||||
@issue = Factory(:issue, :project_id => @project.id)
|
@issue = Factory(:issue, :project_id => @project.id, :creator => @user)
|
||||||
|
|
||||||
@comment = Factory(:comment, :commentable => @issue, :user => @user)
|
@comment = Factory(:comment, :commentable => @issue, :user => @user, :project => @project)
|
||||||
@stranger_comment = Factory(:comment, :commentable => @issue, :user => @stranger)
|
@stranger_comment = Factory(:comment, :commentable => @issue, :user => @stranger, :project => @project)
|
||||||
|
|
||||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||||
end
|
end
|
||||||
|
@ -25,7 +25,7 @@ describe Comment do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should create comment' do
|
it 'should create comment' do
|
||||||
@ability.should be_able_to(:create, Comment.new(:commentable => @issue, :user => @user))
|
@ability.should be_able_to(:create, @comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
pending "sends an e-mail" do
|
pending "sends an e-mail" do
|
||||||
|
@ -60,7 +60,8 @@ describe Comment do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should create comment' do
|
it 'should create comment' do
|
||||||
@ability.should be_able_to(:create, Comment.new(:commentable => @issue, :user => @user))
|
@comment.user = @user
|
||||||
|
@ability.should be_able_to(:create, @comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should update comment' do
|
it 'should update comment' do
|
||||||
|
@ -88,7 +89,7 @@ describe Comment do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should create comment' do
|
it 'should create comment' do
|
||||||
@ability.should be_able_to(:create, Comment.new(:commentable => @issue, :user => @user))
|
@ability.should be_able_to(:create, @comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should update comment' do
|
it 'should update comment' do
|
||||||
|
@ -113,7 +114,7 @@ describe Comment do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should create comment' do
|
it 'should create comment' do
|
||||||
@ability.should be_able_to(:create, Comment.new(:commentable => @issue, :user => @user))
|
@ability.should be_able_to(:create, @comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should update comment' do
|
it 'should update comment' do
|
||||||
|
|
Loading…
Reference in New Issue