Files
aperonight/test/controllers/concerns/stripe_concern_test.rb
kbe 4cde466f9a Add comprehensive unit test coverage for controllers, models, and services
- Translate French comments to English in controllers and tests
- Fix test failures: route helpers, validations, MySQL transaction issues
- Add Timecop for time-dependent tests and update database config for isolation
2025-09-15 19:27:06 +02:00

34 lines
1.0 KiB
Ruby

require "test_helper"
class StripeConcernTest < ActionDispatch::IntegrationTest
setup do
Rails.application.config.stripe = { secret_key: nil }
end
test "stripe_configured? returns false when no secret key" do
controller = ApplicationController.new
controller.extend StripeConcern
assert_not controller.stripe_configured?
end
test "stripe_configured? returns true when secret key present" do
Rails.application.config.stripe = { secret_key: "sk_test_key" }
controller = ApplicationController.new
controller.extend StripeConcern
assert controller.stripe_configured?
end
test "initialize_stripe returns false when not configured" do
controller = ApplicationController.new
controller.extend StripeConcern
assert_not controller.initialize_stripe
end
test "initialize_stripe returns true when configured" do
Rails.application.config.stripe = { secret_key: "sk_test_key" }
controller = ApplicationController.new
controller.extend StripeConcern
assert controller.initialize_stripe
end
end