Testing database connection in rspec
问题 I have setup a resque background job that queries the slave database instead of the master. In my resque class I have added code to establish a connection to the slave and then I de-establish the connection at the end of the method. My question is how would I test in rspec that a query is hitting a specific database within a method? Code sample below: class ResqueJob @queue = :resque_job def self.perform(user_id) ActiveRecord::Base.establish_connection( :adapter => "mysql2", :host => "slave