Skip to content

Commit

Permalink
seed staff user in review apps
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Dec 4, 2023
1 parent 2056be4 commit f8007c0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/start-review-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

/usr/sbin/sshd

bundle exec rails db:schema_load_or_migrate
bundle exec rails runner "%i(eligibility_screener referral_form).each {|flag| FeatureFlags::FeatureFlag.activate(flag)}"
bundle exec rails db:schema_load_or_migrate db:seed:test_data
bundle exec rails runner "%i(eligibility_screener referral_form).each {|flag| FeatureFlags::FeatureFlag.activate(flag)}"
bundle exec rails server -b 0.0.0.0
10 changes: 10 additions & 0 deletions db/test_data_seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
staff = Staff.find_or_initialize_by(
email: "staff@example.com",
manage_referrals: true,
view_support: true,
confirmed_at: 1.second.ago,
) do |s|
s.password = ENV.fetch("SUPPORT_PASSWORD", nil)
end

staff.save(validate: false)
8 changes: 8 additions & 0 deletions lib/tasks/seed.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace(:db) do
namespace(:seed) do
desc "Seeds database with test data"
task test_data: :environment do
load Rails.root.join("db/test_data_seeds.rb")
end
end
end

0 comments on commit f8007c0

Please sign in to comment.