运行ActiveMerchant的单元测试时未初始化的常量ActiveMerchant :: Validateable :: HashWithIndifferentAccess

时间:2011-03-09 12:08:42

标签: ruby-on-rails activesupport

我正在尝试运行ActiveMerchant gem版本的单元测试 1.4.1:https://github.com/Shopify/active_merchant/tree/v1.4.1

首先我跑了:rake -T并得到了错误:

uninitialized constant ActiveMerchant::Validateable::HashWithIndifferentAccess

我通过添加:

修复了第一个错误
gem 'activesupport', "=2.3.4"
require 'active_support'

位于Rakefile (https://github.com/Shopify/active_merchant/blob/v1.4.1/Rakefile的顶部。请注意,我必须指定确切的版本(我猜HashWithIndifferentAccess的更高版本中不存在ActiveSupport).

现在,如果我运行:rake test:units,我得到同样的错误:

uninitialized constant ActiveMerchant::Validateable::HashWithIndifferentAccess

以下是它尝试运行的任务(在同一个Rakefile中):

  Rake::TestTask.new(:units) do |t|
    t.pattern = 'test/unit/**/*_test.rb'
    t.ruby_opts << '-rubygems'
    t.verbose = true
  end

如何摆脱这个错误?我是否需要在任务中指定activesupport gem?

2 个答案:

答案 0 :(得分:0)

gem 'activemerchant' # => Ruby 1.9.2 / AM 1.12.x

VS

gem 'active_merchant' # => ? / AM 1.5.2

答案 1 :(得分:0)

ActiveMerchant是1.12.0版本,因此1.4.1已经很老了 - 您是否尝试过使用最新版本?