0

我在使用 fakefs 规范测试 CSV.open 并引发 ArgumentError: wrong number of arguments (3 for 2) 时遇到问题

规范代码如下:

ruby 版本是 jruby 1.7.1 (1.9.3p327)

fakefs 版本是 0.4.2

需要“假货/安全”

 it 'should pull offers and save them into file' do
    FakeFS do 
      extractor.process(affiliate_ids)
      File::size(FILE_NAME).should > 0
    end
  end

红宝石代码如下:

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

任何人都知道是什么导致了这个问题?提前致谢

吴大卫

4

1 回答 1

1

这个问题在 JRuby 中得到了解决。在此处查看详细信息。https://github.com/defunkt/fakefs/issues/172

-亚历克斯

于 2013-01-15T23:16:57.723 回答