那麼,我們如何解決初始化函數的錯誤,這件事需要做消除這種誤差 Here is the Factories/user.rb FactoryGirl.define do
factory :user do |u|
u.first_name Faker::Name.first_name
u.last_name Faker::Name.last_name
u.emai
我的程序從網上下載一個zip文件然後解析它。相關分析相關的代碼是: Zip::File.open("real_file.zip") do |zip_file|
# do stuff
end
在我的RSpec的測試環境中,我想這個存根代碼解析一個假/模擬文件,而不是真正的一個。具體來說,我想用「mock_file.zip」替換參數值「real_file.zip」。 我嘗試以下方法: