- 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
34 lines
1.0 KiB
Ruby
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
|