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
This commit is contained in:
33
test/controllers/concerns/stripe_concern_test.rb
Normal file
33
test/controllers/concerns/stripe_concern_test.rb
Normal file
@@ -0,0 +1,33 @@
|
||||
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
|
||||
Reference in New Issue
Block a user