Merge pull request #330 from warpc/265-activity_feed_messages

[Refs #265, #263]  fixed tests to issue comments
This commit is contained in:
Vladimir Sharshov 2012-03-22 04:47:55 -07:00
commit 57520c6098
2 changed files with 14 additions and 13 deletions

View File

@ -75,8 +75,8 @@ describe CommentsController do
stub_rsync_methods
@project = Factory(:project)
@issue = Factory(:issue, :project_id => @project.id)
@comment = Factory(:comment, :commentable => @issue)
@issue = Factory(:issue, :project_id => @project.id, :creator => Factory(:user))
@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}
@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)
@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
it_should_behave_like 'user with create comment rights'
@ -108,7 +108,7 @@ describe CommentsController do
@project.update_attribute(:owner, @user)
@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
it_should_behave_like 'user with create comment rights'
@ -123,7 +123,7 @@ describe CommentsController do
set_session_for(@user)
@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
it_should_behave_like 'user with create comment rights'
@ -138,7 +138,7 @@ describe CommentsController do
set_session_for(@user)
@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
it_should_behave_like 'user with create comment rights'

View File

@ -6,10 +6,10 @@ def set_commentable_data
@ability = Ability.new(@user)
@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)
@stranger_comment = Factory(:comment, :commentable => @issue, :user => @stranger)
@comment = Factory(:comment, :commentable => @issue, :user => @user, :project => @project)
@stranger_comment = Factory(:comment, :commentable => @issue, :user => @stranger, :project => @project)
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
end
@ -25,7 +25,7 @@ describe Comment do
end
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
pending "sends an e-mail" do
@ -60,7 +60,8 @@ describe Comment do
end
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
it 'should update comment' do
@ -88,7 +89,7 @@ describe Comment do
end
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
it 'should update comment' do
@ -113,7 +114,7 @@ describe Comment do
end
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
it 'should update comment' do