I'm creating tests for my senders_controller
and am trying to retrieve my base url to be able to call an HTTParty request. I basically need the same method to be able to retrieve me one of these two links depending on the environment:
- in development:
http://localhost:3100/senders
- in production:
https://example.com/senders
My tests work in my spec/senders_controller.rb
like this:
HTTParty.post("http://localhost:3100/senders", query: {email: user.email})
But I want that link to also work in production, which is why I'm looking for a dynamic way to get the base url in both development and production.
Any ideas?