gpt4 book ai didi

ruby-on-rails - 在 GitHub 上测试 fork 的 ruby​​ gems/插件

转载 作者:太空宇宙 更新时间:2023-11-03 18:30:22 25 4
gpt4 key购买 nike

这似乎是一个简单的问题,但我在任何地方都找不到答案。

我在 GitHub 上 fork 了这个 gem:https://github.com/kjvarga/sitemap_generator然后 git 将 fork 克隆到我的本地机器上。

我还没有对其进行任何更改,但想弄清楚如何对其运行测试,以便在我更改它时确保它们仍然通过。

看起来它使用了 rspec,并且在 spec/sitemap_generator 中有一些 rspec 文件。所以我尝试运行 rspec spec/sitemap_generator/* 但我得到了这个:

barmstrong:sitemap_generator$ rspec spec/sitemap_generator/*
/Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require': no such file to load -- rspec/core/mocking/with_mocha (MissingSourceFile)
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:521:in `new_constants_in'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:156:in `require'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:164:in `mock_framework='
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:123:in `mock_with'
from /Users/barmstrong/NetBeansProjects/sitemap_generator/spec/spec_helper.rb:22
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core.rb:56:in `configure'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/backward_compatibility.rb:29:in `configure'
from /Users/barmstrong/NetBeansProjects/sitemap_generator/spec/spec_helper.rb:21
from /Users/barmstrong/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /Users/barmstrong/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /Users/barmstrong/NetBeansProjects/sitemap_generator/spec/sitemap_generator/interpreter_spec.rb:1
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `map'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in `load_spec_files'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in `run'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in `run_in_process'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in `run'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in `autorun'
from /Users/barmstrong/.rvm/gems/ruby-1.8.7-p334/bin/rspec:19
barmstrong:sitemap_generator$

运行 bundle installgem install mocha 似乎没有帮助。

我对 rspec 不是很熟悉(通常只是使用 rake test 来测试带有 ActiveSupport::TestCase 的 Rails 应用程序)。有什么建议吗?

最佳答案

Jörg 在上面发表的评论得出了正确的答案。只需运行 rake test 即可完成我想要的操作。哎呀!

关于ruby-on-rails - 在 GitHub 上测试 fork 的 ruby​​ gems/插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5130943/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com