diff --git a/lib/stripe/engine.rb b/lib/stripe/engine.rb
index <HASH>..<HASH> 100644
--- a/lib/stripe/engine.rb
+++ b/lib/stripe/engine.rb
@@ -81,7 +81,9 @@ environment file directly.
     end
 
     initializer 'stripe.assets.precompile' do |app|
-      app.config.assets.precompile += %w( stripe_elements.js stripe_elements.css )
+      unless ::Rails.env.test?
+        app.config.assets.precompile += %w( stripe_elements.js stripe_elements.css )
+      end
     end
 
     rake_tasks do
Skip asset precompilation in test env