同志们,如何用嵌套私有方法“self.merge_op”测试方法“self.default”?我m noob in RSpec. What is more suitable for such case: mocking/stubbing?
Functionality of file - it
是某种 MailClient
class MailClient
def self.default
options = self.merge_op
@clients[options] = MailClient.send :new unless @clients.has_key?(options)
@clients[options]
end
def self.merge_op(opts={:smtp => {}, :pop3 => {}})
def_smtp_opts = {:address => settings.mail_smtp_server,
:port => settings.mail_smtp_port,
:domain => settings.mail_smtp_domain,
:user_name => settings.mail_smtp_user_name,
:password => settings.mail_smtp_user_pass,
:authentication => 'plain',
:enable_starttls_auto => true}
end