Move and amend the issue comment controller tests.
This commit is contained in:
parent
3276063fcf
commit
a09e3f3fe0
2 changed files with 26 additions and 22 deletions
26
test/controllers/issue_comments_controller_test.rb
Normal file
26
test/controllers/issue_comments_controller_test.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
require "test_helper"
|
||||
|
||||
class IssueCommentsControllerTest < ActionController::TestCase
|
||||
def test_comment_by_normal_user
|
||||
issue = create(:issue)
|
||||
|
||||
# Login as normal user
|
||||
session[:user] = create(:user).id
|
||||
|
||||
post :create, :params => { :issue_id => issue.id }
|
||||
assert_response :redirect
|
||||
assert_redirected_to root_path
|
||||
end
|
||||
|
||||
def test_comment
|
||||
issue = create(:issue)
|
||||
|
||||
# Login as administrator
|
||||
session[:user] = create(:administrator_user).id
|
||||
|
||||
post :create, :params => { :issue_id => issue.id, :issue_comment => { :body => "test comment" } }
|
||||
assert_response :redirect
|
||||
assert_redirected_to issue
|
||||
assert_equal 1, issue.comments.length
|
||||
end
|
||||
end
|
|
@ -219,26 +219,4 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
get :index, :params => { :search_by_user => bad_user.display_name }
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_comment_by_normal_user
|
||||
issue = create(:issue)
|
||||
|
||||
# Login as normal user
|
||||
session[:user] = create(:user).id
|
||||
|
||||
get :comment, :params => { :id => issue.id }
|
||||
assert_response :redirect
|
||||
assert_redirected_to root_path
|
||||
end
|
||||
|
||||
def test_comment
|
||||
issue = create(:issue)
|
||||
|
||||
# Login as administrator
|
||||
session[:user] = create(:administrator_user).id
|
||||
|
||||
get :comment, :params => { :id => issue.id, :issue_comment => { :body => "test comment" } }
|
||||
assert_response :redirect
|
||||
assert_redirected_to issue
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue