0

同志、ネストされたプライベートメソッド「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
4

1 に答える 1