如何使用Rspec和Cucumber創建和測試gem

[英]How to create and test a gem with Rspec and Cucumber


I have created a model that I use across applications.

我創建了一個跨應用程序使用的模型。

module WeblabOnRails
  class TimeOnly
    #...
  end
end

I put the code in my lib/weblab_on_rails/time_only.rb and I invoke it, each time from application.rb.

我把代碼放在我的lib / weblab_on_rails / time_only.rb中,每次都從application.rb調用它。

I would like to integrate that code into a gem and write tests using Rspec and Cucumber. I am using Rails 3.2.5.

我想將該代碼集成到gem中,並使用Rspec和Cucumber編寫測試。我正在使用Rails 3.2.5。

1 个解决方案

#1


1  

I recommend you using bundler to create and publish gems. Check out this RailsCast: http://railscasts.com/episodes/245-new-gem-with-bundler. Once you created your gem project you can use RSpec, Cucumber or whatever to test it.

我建議您使用bundler來創建和發布gem。看看這個RailsCast:http://railscasts.com/episodes/245-new-gem-with-bundler。創建寶石項目后,您可以使用RSpec,Cucumber或其他任何東西進行測試。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2012/06/25/906b256220f6fd32a38e20ca87d5cf10.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com