X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/e8af4b85bf001ade543d03a503c769055d42e6a2..5d1bc7a4fa3f21db35ca95292ec9a383476c3843:/test/controllers/user_blocks_controller_test.rb diff --git a/test/controllers/user_blocks_controller_test.rb b/test/controllers/user_blocks_controller_test.rb index 27022c973..2c363be3d 100644 --- a/test/controllers/user_blocks_controller_test.rb +++ b/test/controllers/user_blocks_controller_test.rb @@ -261,6 +261,21 @@ class UserBlocksControllerTest < ActionDispatch::IntegrationTest assert_select "h1", "The user non_existent_user does not exist" end + ## + # test the duration of a created block + def test_create_duration + target_user = create(:user) + moderator_user = create(:moderator_user) + + session_for(moderator_user) + post user_blocks_path(:display_name => target_user.display_name, + :user_block_period => "336", + :user_block => { :needs_view => false, :reason => "Vandalism" }) + + block = UserBlock.order(:id).last + assert_equal 1209600, block.ends_at - block.created_at + end + ## # test the update action def test_update