openstreetmap-website/test/helpers/user_blocks_helper_test.rb
Tom Hughes 9b52542e52 Use simple string matches for user_blocks_helper tests
Testing against the translations is not something we do anywhere
else is and is dangerously close to testing the helper against
itself which is a bit pointless.
2017-02-19 11:50:01 +00:00

16 lines
651 B
Ruby

require "test_helper"
class UserBlocksHelperTest < ActionView::TestCase
include ApplicationHelper
def test_block_status
block = create(:user_block, :needs_view, :ends_at => Time.now.getutc)
assert_equal "Active until the user logs in.", block_status(block)
block = create(:user_block, :needs_view, :ends_at => Time.now.getutc + 1.hour)
assert_match %r{^Ends in <span title=".*">about 1 hour</span> and after the user has logged in\.$}, block_status(block)
block = create(:user_block, :ends_at => Time.now.getutc + 1.hour)
assert_match %r{^Ends in <span title=".*">about 1 hour</span>\.$}, block_status(block)
end
end