简体   繁体   English

如何运行Ruby gem的规格?

[英]How do I run a Ruby gem's specs?

I have forked a ruby gem and made some updates. 我已经分叉了一个红宝石宝石并做了一些更新。 I need to run the gem tests and add my new tests and ensure all tests are succeeding. 我需要运行gem测试并添加我的新测试并确保所有测试都成功。

The forked ruby gem is using rspec tests. 分叉的红宝石宝石正在使用rspec测试。 How can I run these test? 我该如何运行这些测试?

Usually rake is sufficient to run all the tests, regardless of whether they're RSpec, Cucumber, etc. If you want to invoke RSpec directly try running rspec spec instead, or if the gem is using an unconventionally named test directory, just use rspec <directory_name> . 通常rake足以运行所有测试,无论它们是RSpec,Cucumber等。如果你想直接调用RSpec尝试运行rspec spec ,或者如果gem使用非常规命名的测试目录,只需使用rspec <directory_name>

Note: Most new gems these days use Bundler to manage dependencies, so if you don't have the appropriate dependencies and there's a Gemfile in the root, then run "bundle install" first to get them. 注意:现在大多数新宝石使用Bundler来管理依赖项,所以如果你没有相应的依赖项并且root中有一个Gemfile,那么先运行“bundle install”来获取它们。 Then run with bundle exec ... (eg, bundle exec rspec spec ). 然后使用bundle exec ...运行(例如, bundle exec rspec spec )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM