Put the expected value first in assert_equal
This commit is contained in:
parent
1766c3216f
commit
f0bcdae908
2 changed files with 13 additions and 13 deletions
|
@ -36,7 +36,7 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
# Login as normal user
|
||||
session[:user] = create(:user).id
|
||||
|
||||
assert_equal Issue.count, 1
|
||||
assert_equal 1, Issue.count
|
||||
|
||||
get :resolve, :params => { :id => issue.id }
|
||||
|
||||
|
@ -53,17 +53,17 @@ class IssuesControllerTest < ActionController::TestCase
|
|||
|
||||
# Test 'Resolved'
|
||||
get :resolve, :params => { :id => issue.id }
|
||||
assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").resolved?, true
|
||||
assert_equal true, Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").resolved?
|
||||
assert_response :redirect
|
||||
|
||||
# Test 'Reopen'
|
||||
get :reopen, :params => { :id => issue.id }
|
||||
assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").open?, true
|
||||
assert_equal true, Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").open?
|
||||
assert_response :redirect
|
||||
|
||||
# Test 'Ignored'
|
||||
get :ignore, :params => { :id => issue.id }
|
||||
assert_equal Issue.find_by(:reportable_id => target_user, :reportable_type => "User").ignored?, true
|
||||
assert_equal true, Issue.find_by(:reportable_id => target_user, :reportable_type => "User").ignored?
|
||||
assert_response :redirect
|
||||
end
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
|
||||
session[:user] = create(:user).id
|
||||
|
||||
assert_equal Issue.count, 0
|
||||
assert_equal 0, Issue.count
|
||||
|
||||
# Create an Issue and a report
|
||||
get :new, :params => { :reportable_id => target_user.id, :reportable_type => "User" }
|
||||
|
@ -28,7 +28,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
}
|
||||
}
|
||||
end
|
||||
assert_equal Issue.count, 1
|
||||
assert_equal 1, Issue.count
|
||||
assert_response :redirect
|
||||
assert_redirected_to root_path
|
||||
end
|
||||
|
@ -40,7 +40,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
# Login
|
||||
session[:user] = create(:user).id
|
||||
|
||||
assert_equal Issue.count, 0
|
||||
assert_equal 0, Issue.count
|
||||
|
||||
# Create an Issue and a report
|
||||
get :new, :params => { :reportable_id => target_user.id, :reportable_type => "User" }
|
||||
|
@ -55,7 +55,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
}
|
||||
}
|
||||
end
|
||||
assert_equal Issue.count, 1
|
||||
assert_equal 1, Issue.count
|
||||
assert_response :redirect
|
||||
assert_redirected_to root_path
|
||||
|
||||
|
@ -74,7 +74,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
}
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count, 1
|
||||
assert_equal 1, Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count
|
||||
|
||||
# Report without details
|
||||
assert_no_difference "Issue.count" do
|
||||
|
@ -86,7 +86,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
}
|
||||
end
|
||||
assert_response :redirect
|
||||
assert_equal Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count, 1
|
||||
assert_equal 1, Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count
|
||||
end
|
||||
|
||||
def test_new_report_with_complete_details
|
||||
|
@ -96,7 +96,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
# Login
|
||||
session[:user] = create(:user).id
|
||||
|
||||
assert_equal Issue.count, 0
|
||||
assert_equal 0, Issue.count
|
||||
|
||||
# Create an Issue and a report
|
||||
get :new, :params => { :reportable_id => target_user.id, :reportable_type => "User" }
|
||||
|
@ -111,7 +111,7 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
}
|
||||
}
|
||||
end
|
||||
assert_equal Issue.count, 1
|
||||
assert_equal 1, Issue.count
|
||||
assert_response :redirect
|
||||
assert_redirected_to root_path
|
||||
|
||||
|
@ -130,6 +130,6 @@ class ReportsControllerTest < ActionController::TestCase
|
|||
end
|
||||
assert_response :redirect
|
||||
report_count = Issue.find_by(:reportable_id => target_user.id, :reportable_type => "User").reports.count
|
||||
assert_equal report_count, 2
|
||||
assert_equal 2, report_count
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue