1
단위 테스트 외부에서 mocha를 사용하여 Net :: HTTPResponse 객체를 모의하려고합니다.단위 테스트 외부에서 모카를 사용하는 방법은 무엇입니까?
#!/usr/bin/env ruby -w
require 'net/http'
require 'rubygems'
require 'mocha'
response = mock('Net::HTTPResponse')
response.stubs(:code => '500', :message => "Failed", :content_type => "text/plaint", :body => '')
나는이 오류를 얻을 :
undefined method `mock' for main:Object (NoMethodError)