feat: Use invoice emitter details from env var

This commit is contained in:
kbe
2025-09-10 10:21:32 +02:00
parent 2fb0e1fdbb
commit 8d2127fce2
7 changed files with 42 additions and 42 deletions

View File

@@ -4,7 +4,7 @@ class ApplicationControllerOnboardingTest < ActionDispatch::IntegrationTest
setup do
@user_without_onboarding = users(:one)
@user_without_onboarding.update!(onboarding_completed: false)
@user_with_onboarding = users(:two)
@user_with_onboarding.update!(onboarding_completed: true, first_name: "John", last_name: "Doe")
end
@@ -54,4 +54,4 @@ class ApplicationControllerOnboardingTest < ActionDispatch::IntegrationTest
get onboarding_path
assert_response :success
end
end
end

View File

@@ -4,7 +4,7 @@ class OnboardingControllerTest < ActionDispatch::IntegrationTest
setup do
@user_without_onboarding = users(:one)
@user_without_onboarding.update!(onboarding_completed: false)
@user_with_onboarding = users(:two)
@user_with_onboarding.update!(onboarding_completed: true, first_name: "John", last_name: "Doe")
end
@@ -30,20 +30,20 @@ class OnboardingControllerTest < ActionDispatch::IntegrationTest
test "should complete onboarding with valid data" do
sign_in @user_without_onboarding
assert_not @user_without_onboarding.onboarding_completed?
post complete_onboarding_path, params: {
user: {
first_name: "Jane",
last_name: "Smith"
}
}
assert_redirected_to dashboard_path
follow_redirect!
assert_select ".notification", /Bienvenue sur Aperonight/
@user_without_onboarding.reload
assert @user_without_onboarding.onboarding_completed?
assert_equal "Jane", @user_without_onboarding.first_name
@@ -52,34 +52,34 @@ class OnboardingControllerTest < ActionDispatch::IntegrationTest
test "should not complete onboarding without required fields" do
sign_in @user_without_onboarding
post complete_onboarding_path, params: {
user: {
first_name: "",
last_name: "Smith"
}
}
assert_response :success
assert_select ".notification", /Veuillez remplir tous les champs requis/
@user_without_onboarding.reload
assert_not @user_without_onboarding.onboarding_completed?
end
test "should not complete onboarding without last name" do
sign_in @user_without_onboarding
post complete_onboarding_path, params: {
user: {
first_name: "Jane",
last_name: ""
}
}
assert_response :success
assert_select ".notification", /Veuillez remplir tous les champs requis/
@user_without_onboarding.reload
assert_not @user_without_onboarding.onboarding_completed?
end

View File

@@ -24,7 +24,7 @@ class TicketMailerTest < ActionMailer::TestCase
assert_equal [ "no-reply@aperonight.fr" ], email.from
assert_equal [ @user.email ], email.to
assert_equal "Confirmation d'achat - #{@event.name}", email.subject
# Check if we have any content
content = ""
if email.html_part
@@ -34,7 +34,7 @@ class TicketMailerTest < ActionMailer::TestCase
else
content = email.body.to_s
end
# If still empty, try to get content from parts
if content.empty? && email.parts.any?
email.parts.each do |part|
@@ -44,7 +44,7 @@ class TicketMailerTest < ActionMailer::TestCase
end
end
end
# Instead of strict matching, just check that content exists
assert content.length > 0, "Email body should not be empty"
assert_match @event.name, content
@@ -64,7 +64,7 @@ class TicketMailerTest < ActionMailer::TestCase
assert_equal [ "no-reply@aperonight.fr" ], email.from
assert_equal [ @ticket.user.email ], email.to
assert_equal "Confirmation d'achat - #{@ticket.event.name}", email.subject
# Check if we have any content
content = ""
if email.html_part
@@ -74,7 +74,7 @@ class TicketMailerTest < ActionMailer::TestCase
else
content = email.body.to_s
end
# If still empty, try to get content from parts
if content.empty? && email.parts.any?
email.parts.each do |part|
@@ -84,7 +84,7 @@ class TicketMailerTest < ActionMailer::TestCase
end
end
end
# Instead of strict matching, just check that content exists
assert content.length > 0, "Email body should not be empty"
assert_match @ticket.event.name, content
@@ -105,7 +105,7 @@ class TicketMailerTest < ActionMailer::TestCase
assert_equal [ "no-reply@aperonight.fr" ], email.from
assert_equal [ @user.email ], email.to
assert_equal "Rappel : #{@event.name} dans une semaine", email.subject
# Check content properly
content = ""
if email.html_part
@@ -115,7 +115,7 @@ class TicketMailerTest < ActionMailer::TestCase
else
content = email.body.to_s
end
assert content.length > 0, "Email body should not be empty"
assert_match /une semaine/, content
assert_match @event.name, content
@@ -136,7 +136,7 @@ class TicketMailerTest < ActionMailer::TestCase
end
assert_equal "Rappel : #{@event.name} demain", email.subject
# Check content properly
content = ""
if email.html_part
@@ -146,7 +146,7 @@ class TicketMailerTest < ActionMailer::TestCase
else
content = email.body.to_s
end
assert content.length > 0, "Email body should not be empty"
assert_match /demain/, content
end
@@ -161,7 +161,7 @@ class TicketMailerTest < ActionMailer::TestCase
end
assert_equal "C'est aujourd'hui : #{@event.name}", email.subject
# Check content properly
content = ""
if email.html_part
@@ -171,7 +171,7 @@ class TicketMailerTest < ActionMailer::TestCase
else
content = email.body.to_s
end
assert content.length > 0, "Email body should not be empty"
assert_match /aujourd'hui/, content
end
@@ -186,7 +186,7 @@ class TicketMailerTest < ActionMailer::TestCase
end
assert_equal "Rappel : #{@event.name} dans 3 jours", email.subject
# Check content properly
content = ""
if email.html_part
@@ -196,7 +196,7 @@ class TicketMailerTest < ActionMailer::TestCase
else
content = email.body.to_s
end
assert content.length > 0, "Email body should not be empty"
assert_match /3 jours/, content
end

View File

@@ -74,21 +74,21 @@ class UserTest < ActiveSupport::TestCase
test "should complete onboarding" do
user = users(:one)
user.update!(onboarding_completed: false)
assert user.needs_onboarding?, "User should need onboarding initially"
user.complete_onboarding!
assert_not user.needs_onboarding?, "User should not need onboarding after completion"
assert user.onboarding_completed?, "User should have completed onboarding"
end
test "needs_onboarding? should return correct value" do
user = users(:one)
user.update!(onboarding_completed: false)
assert user.needs_onboarding?, "User with false onboarding_completed should need onboarding"
user.update!(onboarding_completed: true)
assert_not user.needs_onboarding?, "User with true onboarding_completed should not need onboarding"
end

View File

@@ -17,7 +17,7 @@ module ActiveSupport
fixtures :all
# Add more helper methods to be used by all tests here...
# Helper to create users with completed onboarding by default for tests
def create_test_user(attributes = {})
User.create!({