我在使用fakefs测试CSV.open并引发ArgumentError时出现问题:参数数量错误(3为2)
规范代码如下:
ruby版本是jruby 1.7.1(1.9.3p327)
fakefs版本是0.4.2
要求'fakefs / safe'
it 'should pull offers and save them into file' do
FakeFS do
extractor.process(affiliate_ids)
File::size(FILE_NAME).should > 0
end
end
ruby代码如下:
class Extractor
def process(affiliates)
save(ds)
end
# saves all the buy URLs to a text file
def save(ds)
@@logger.info "Writing offers to file #{FILE_NAME}"
CSV.open(FILE_NAME, "w") do |csv|
ds.each do |row|
buy_url = row[:buy_url]
csv << [row[:name], row[:offer_id], buy_url]
end
end
end
end
有谁知道导致这个问题的原因是什么? 提前致谢
David Wu