Hello, I created a new project with solidus_starte...
# support
a
Hello, I created a new project with solidus_starter_frontend. After changing
currency
and
default_country_iso
in
config/initializers/spree.rb
I get a lot of tests failing. I would like to override my spree configuration when running the tests, so that they don't fail when I change the configuration. Any tip on how can I achieve this?
j
Your tests should be running with the same configuration as you use in production, so you can update the tests to match the new configuration or to read the configuration and use it. Alternatively, you can conditionally set configuration based on the Rails env, but I wouldn't recommend that.
a
Thank you very much. Can you explain why you advice to update the tests instead of changing the configuration? Personally I believe that tests should be independent from the configuration. I would like to understand your point of view.
j
I don't know what tests are failing, so I can't give you specific advice on updating the tests. When testing a framework you probably want to test different possible configurations, but the tests for a store should be testing the configuration you're using. The tests should reflect the production usage. I wouldn't expect currency or default_country_iso to change once set to their desired values, so I would hardcode references them in the test suite. If you want to make your tests configuration independent, then you can reference the values in your tests, for example using the configured currency when creating prices.
a
all right, I understand. Thank you very much 👍