]> git.openstreetmap.org Git - rails.git/blob - test/helpers/user_blocks_helper_test.rb
Use the factory to create user blocks
[rails.git] / test / helpers / user_blocks_helper_test.rb
1 require "test_helper"
2
3 class UserBlocksHelperTest < ActionView::TestCase
4   include ApplicationHelper
5
6   def test_block_status
7     block = create(:user_block, :needs_view, :ends_at => Time.now.getutc)
8     assert_equal I18n.t("user_block.helper.until_login"), block_status(block)
9
10     block_end = Time.now.getutc + 60.minutes
11     block = create(:user_block, :needs_view, :ends_at => block_end)
12     assert_equal I18n.t("user_block.helper.time_future_and_until_login", :time => friendly_date(block_end)), block_status(block)
13
14     block_end = Time.now.getutc + 60.minutes
15     block = create(:user_block, :ends_at => block_end)
16     assert_equal I18n.t("user_block.helper.time_future", :time => friendly_date(block_end)), block_status(block)
17   end
18 end