# frozen_string_literal: true

# == Schema Information
#
# Table name: users
#
#  id                                   :bigint           not null, primary key
#  avatar                               :string
#  badges                               :string           default([]), is an Array
#  devlogs_count                        :integer          default(0), not null
#  display_name                         :string
#  email                                :string
#  first_name                           :string
#  fraud_team_member                    :boolean          default(FALSE), not null
#  freeze_shop_activity                 :boolean          default(FALSE)
#  has_black_market                     :boolean
#  has_clicked_completed_tutorial_modal :boolean          default(FALSE), not null
#  has_commented                        :boolean          default(FALSE)
#  has_hackatime                        :boolean          default(FALSE)
#  has_hackatime_account                :boolean
#  identity_vault_access_token          :string
#  internal_notes                       :text
#  is_admin                             :boolean          default(FALSE), not null
#  is_banned                            :boolean          default(FALSE)
#  last_name                            :string
#  permissions                          :text             default([])
#  projects_count                       :integer          default(0), not null
#  shenanigans_state                    :jsonb
#  ship_events_count                    :integer          default(0), not null
#  synced_at                            :datetime
#  timezone                             :string
#  tutorial_video_seen                  :boolean          default(FALSE), not null
#  votes_count                          :integer          default(0), not null
#  wrapped_share_token                  :string
#  ysws_verified                        :boolean          default(FALSE)
#  created_at                           :datetime         not null
#  updated_at                           :datetime         not null
#  identity_vault_id                    :string
#  slack_id                             :string
#
# Indexes
#
#  index_users_on_projects_count       (projects_count)
#  index_users_on_ship_events_count    (ship_events_count)
#  index_users_on_votes_count          (votes_count)
#  index_users_on_wrapped_share_token  (wrapped_share_token) UNIQUE
#
require "test_helper"

class UserTest < ActiveSupport::TestCase
  test "user can be blocked from recertification" do
    user = users(:one)

    assert_not user.recertification_blocked?

    user.add_permission("no_recert")
    assert user.recertification_blocked?

    user.remove_permission("no_recert")
    assert_not user.recertification_blocked?
  end
end
