From ae2eba89ca7f6a1083f31d6bcb8e801055da2d51 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Tue, 6 Mar 2018 15:25:58 +0100 Subject: [PATCH] Automatically confirm the spree@example.com user This allows you to log in with it after you run `bundle exec openfoodnetwork:dev:load_sample_data` rake task right away. --- lib/tasks/dev.rake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/tasks/dev.rake b/lib/tasks/dev.rake index 017bc0817d..25fbdd0ad0 100644 --- a/lib/tasks/dev.rake +++ b/lib/tasks/dev.rake @@ -9,9 +9,11 @@ namespace :openfoodnetwork do require_relative '../../spec/support/spree/init' task_name = "openfoodnetwork:dev:load_sample_data" + spree_user = Spree::User.find_by_email('spree@example.com') + Spree::MailMethod.create!( environment: Rails.env, - preferred_mails_from: 'spree@example.com' + preferred_mails_from: spree_user.email ) # -- Shipping / payment information @@ -193,6 +195,8 @@ namespace :openfoodnetwork do CreateOrderCycle.new(enterprise2, variants).call EnterpriseRole.create!(user: Spree::User.first, enterprise: enterprise2) + + spree_user.confirm! end # Creates an order cycle for the provided enterprise and selecting all the