GDS::SSO.config do |config|
  config.user_model = 'User'

  config.oauth_id = ENV['OAUTH_ID']
  config.oauth_root_url = ENV.fetch('OAUTH_ROOT_URL', 'http://localhost:3001')
  config.oauth_secret = ENV['OAUTH_SECRET']

  config.cache = Rails.cache
end

if Rails.env.development?
  GDS::SSO.test_user = User.find_or_create_by(name: 'Test User') do |user|
    user.permissions << User::RESOURCE_MANAGER_PERMISSION
  end
end

GDS::SSO.config do |config|
  config.user_model = 'User'

  config.oauth_id = ENV['OAUTH_ID']
  config.oauth_root_url = ENV.fetch('OAUTH_ROOT_URL', 'http://localhost:3001')
  config.oauth_secret = ENV['OAUTH_SECRET']

  config.cache = Rails.cache
end

if Rails.env.development?
  test_user = User.first_or_initialize(name: 'Test User')
  test_user.permissions << User::RESOURCE_MANAGER_PERMISSION
  test_user.save!
end

Change strategy for auto-generating test user
Change strategy for auto-generating test user

We need to ensure that the FIRST user always has the resource_manager
permission, not just the user with the name "Test User".

Also, we don't need to set GDS::SSO.test_user because by default it will
use User.first.
