test/integration/navigation_test.rb in merit-2.0.0 vs test/integration/navigation_test.rb in merit-2.1.0
- old
+ new
@@ -1,8 +1,9 @@
require 'test_helper'
class NavigationTest < ActiveSupport::IntegrationCase
+
def tear_down
DummyObserver.unstub(:update)
end
test 'user sign up should grant badge to itself' do
@@ -89,11 +90,20 @@
assert_equal 15, user.points
user.subtract_points 15
assert_equal 0, user.points
assert_equal 2, Merit::Score::Point.count
- # Make tenth comment, assert 10-commenter badge granted
+ # Tenth comment with errors doesn't change reputation
+ badges = user.reload.badges
+ points = user.points
visit '/comments/new'
+ assert_no_difference('Merit::ActivityLog.count') do
+ click_button('Create Comment')
+ end
+ assert_equal badges, user.reload.badges
+ assert_equal points, user.points
+
+ # Tenth comment without errors, assert 10-commenter badge granted
fill_in 'Name', with: 'Hi!'
fill_in 'Comment', with: 'Hi bro!'
fill_in 'User', with: user.id
assert_difference('Merit::ActivityLog.count', 2) do
click_button('Create Comment')