Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guidelines how to test applications that use this library #11

Closed
jage opened this issue Oct 21, 2015 · 4 comments
Closed

Guidelines how to test applications that use this library #11

jage opened this issue Oct 21, 2015 · 4 comments

Comments

@jage
Copy link
Contributor

jage commented Oct 21, 2015

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:

def create_connection
if ruby_env == "development"
connection = Bunny.new
else
connection_options = {
hosts: amqp_hosts,
user: ENV.fetch("AMQP_USERNAME"),
pass: ENV.fetch("AMQP_PASSWORD"),
recover_from_connection_close: true,
}
connection = Bunny.new(connection_options)
end
connection.start
connection
end

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
Copy link
Contributor Author

jage commented Oct 21, 2015

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

@roback
Copy link
Member

roback commented Nov 2, 2015

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

@dentarg
Copy link
Contributor

dentarg commented Dec 17, 2015

Just a note that #36 removed usage of RUBY_ENV.

@walro
Copy link
Contributor

walro commented May 23, 2016

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.

@walro walro closed this as completed May 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants