Closed jage closed 8 years ago
RABBITMQ_N_HOST
can be avoided by giving hosts when initializing the connection.
AMQP_USERNAME
and AMQP_PASSWORD
can now also be set when initializing the connection instead of using environment variables (since #26).
Just a note that https://github.com/twingly/twingly-amqp/pull/36 removed usage of RUBY_ENV
.
I think that #26 and #36 made this easy enough to test. There are some other issues related to testing that will make this glorious, e.g. #29, #39, #40, #45 and possibly more to come.
For example, currently you need to set
AMQP_USERNAME
,AMQP_PASSWORD
,RABBITMQ_N_HOST
for tests since theRUBY_ENV
isn't "development".This could be changed easily in: https://github.com/twingly/twingly-amqp/blob/4e96a64acff6bff4816831cb99623e9263d6cebd/lib/twingly/amqp/connection.rb#L15-L29
Another idea is that we should look at both
RUBY_ENV
andRACK_ENV
to figure out if we're in production or not.An alternative solution might be that we expose some other API for tests (fake connection?).