【问题标题】:FakeFS and CSV.open spec test raises ArgumentError:wrong number of arguments (3 for 2)FakeFS 和 CSV.open 规范测试引发 ArgumentError:wrong number of arguments (3 for 2)
【发布时间】:2012-12-29 04:09:25
【问题描述】:

我在使用 fakefs 规范测试 CSV.open 并引发 ArgumentError: wrong number of arguments (3 for 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

有谁知道是什么导致了这个问题? 提前致谢

吴大卫

【问题讨论】:

    标签: ruby csv rspec


    【解决方案1】:

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

    -亚历克斯

    【讨论】:

      猜你喜欢
      • 2013-12-12
      • 1970-01-01
      • 1970-01-01
      • 2022-10-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-19
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多