twingly / twingly-amqp

:bus: Ruby gem for RabbitMQ subscribing and publishing
0 stars 0 forks source link

Guidelines how to test applications that use this library #11

Closed jage closed 8 years ago

jage commented 8 years ago

For example, currently you need to set AMQP_USERNAME, AMQP_PASSWORD, RABBITMQ_N_HOST for tests since the RUBY_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 and RACK_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?).

jage commented 8 years ago

RABBITMQ_N_HOST can be avoided by giving hosts when initializing the connection.

roback commented 8 years ago

AMQP_USERNAME and AMQP_PASSWORD can now also be set when initializing the connection instead of using environment variables (since #26).

dentarg commented 8 years ago

Just a note that https://github.com/twingly/twingly-amqp/pull/36 removed usage of RUBY_ENV.

walro commented 8 years ago

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.