如何运行activeadmin gem的规范

时间:2017-03-20 19:34:59

标签: ruby-on-rails activeadmin

我正在尝试为activeadmin gem当前主人的本地克隆运行规范。

我正在使用ruby 2.2.2并已成功捆绑。 当我尝试运行其中一个规范时:

bundle exec rspec spec/unit/filters/humanized_spec.rb

我收到以下错误: The git source https://github.com/jruby/activerecord-jdbc-adapter is not yet checked out. Please run `bundle install` before trying to start your application Coverage report generated for RSpec to /Users/aljoscha/gem/activeadmin/coverage. 0.0 / 0.0 LOC (100.0%) covered. /Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `require': cannot load such file -- active_record (LoadError) from /Users/aljoscha/gem/activeadmin/spec/rails_helper.rb:13:in `<top (required)>' from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `require' from /Users/aljoscha/gem/activeadmin/spec/unit/filters/humanized_spec.rb:1:in `<top (required)>' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `load' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1435:in `block in load_spec_files' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `each' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/configuration.rb:1433:in `load_spec_files' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:100:in `setup' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:86:in `run' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:71:in `run' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/lib/rspec/core/runner.rb:45:in `invoke' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.5.4/exe/rspec:4:in `<top (required)>' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `load' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/rspec:22:in `<main>' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval' from /Users/aljoscha/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>' 这是我无法理解的。

特别是因为activerecord-jdbc-adapter甚至不在Gemfile中。

我错过了什么?

2 个答案:

答案 0 :(得分:1)

尝试使用bundle exec

添加命令
bundle exec rspec spec/unit/filters/humanized_spec.rb

看起来您的本地版本存在差异导致问题。

如果没有,您是否按照contributing readme上列出的所有步骤进行了操作?

如果您仍然遇到问题,您可能会遇到bundler本身的问题。首先,尝试更新bundler然后重新安装gems并尝试运行rspec。如果这不起作用,您可能需要删除捆绑缓存文件夹并重新开始。

答案 1 :(得分:0)

我将重新回答以强调如何使用appraisal中提到的CONTIBUTING测试宝石:

bundle exec appraisal install
bundle exec appraisal rails_50 rspec spec/unit/filters/humanized_spec.rb

感谢您对Active Admin的兴趣。