Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to users yml file #1000

Merged
merged 9 commits into from
Dec 20, 2023
2 changes: 2 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class Application < Rails::Application
config.user_timeout_warning_minutes = ENV.fetch('TIMEOUT_WARNING_MINUTES', '20').to_i
config.user_timeout_modal_visible = ENV.fetch('TIMEOUT_MODAL_VISIBLE', '5').to_i

config.user_password = ENV.fetch('USER_PASSWORD', 'Str0ngPa$$word12')

# Contentful
config.contentful_space = ENV.fetch('CONTENTFUL_SPACE', credentials.dig(:contentful, :space))
config.contentful_delivery_access_token = ENV.fetch('CONTENTFUL_DELIVERY_TOKEN', credentials.dig(:contentful, :delivery_access_token))
Expand Down
6 changes: 3 additions & 3 deletions db/seeds/users.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
---
[email protected]:
password: <%= ENV.fetch('USER_PASSWORD', 'Str0ngPa$$word') %>
password: <%= Rails.configuration.user_password %>
terms_and_conditions_agreed_at: <%= 1.minute.ago %>

[email protected]:
password: <%= ENV.fetch('USER_PASSWORD', 'Str0ngPa$$w0rd12') %>
password: <%= Rails.configuration.user_password %>
terms_and_conditions_agreed_at: <%= 1.minute.ago %>
confirmed_at: <%= 1.minute.ago %>

[email protected]:
password: <%= ENV.fetch('USER_PASSWORD', 'Str0ngPa$$w0rd') %>
password: <%= Rails.configuration.user_password %>
terms_and_conditions_agreed_at: <%= 1.minute.ago %>
confirmed_at: <%= 1.minute.ago %>
first_name: Demo
Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/eyfs.rake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace :eyfs do
unless User.find_by(email: "#{bot_token}@example.com")
User.create!(
email: "#{bot_token}@example.com",
password: ENV.fetch('USER_PASSWORD', 'Str0ngPa$$w0rd'),
password: Rails.configuration.user_password,
confirmed_at: Time.zone.now,
terms_and_conditions_agreed_at: Time.zone.now,
first_name: 'Bot',
Expand Down
14 changes: 14 additions & 0 deletions spec/config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,24 @@
expect(config.internal_mailbox).to eq '[email protected]'
end

it 'sets password for seeds' do
expect(config.user_password).to eq 'Str0ngPa$$word12'
end

it 'exports dashboard statistics daily at midnight' do
expect(config.dashboard_update_interval).to eq '0 0 * * *'
end

describe 'seeded users' do
before do
Dibber::Seeder.seed(:user, name_method: :email)
end

specify do
expect(User.count).to eq 3
end
end

describe 'time out' do
it 'sets interval in minutes' do
expect(config.user_timeout_minutes).to eq 25
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/sign_in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def with_email_and_password(email = nil, password = nil)
wait_until_header_visible

email ||= '[email protected]'
password ||= ENV.fetch('USER_PASSWORD', 'Str0ngPa$$w0rd')
password ||= Rails.configuration.user_password

email_field.set(email)
password_field.set(password)
Expand Down