Has anyone used Minitest::Spec withing a Rails functional test?

三世轮回 提交于 2019-12-04 20:13:54

问题


The spec library in Minitest is great. I've been able to use it within Rails unit tests no problem. However, Rails functional test inherit from ActionController::TestCase which provides instance variables like @controller in it's setup.

Has anyone been using the Minitest::Spec lib for their Rails functional tests?

If not, I'm considering creating a small library to do just that. I'm not too keen on rspec, and shoulda is starting to shift it's focus to rspec. It would be nice to have something lightweight and built on tools already provided.


回答1:


Thoughtbot have now split shoulda into shoulda_contexts and shoulda_matchers so the worry about a shift to rspec for thoughtbot doesn't mean shoulda contexts are going away. Just being maintained in the community.




回答2:


Here's a simple test_helper rig to run functional & integration tests in Rails using spec syntax. Based on a gist by tenderlove, this excellent article about MiniTest with Capybara, & a lot of tinkering & source-poring.

https://gist.github.com/1607879




回答3:


Maybe try http://metaskills.net/2011/03/26/using-minitest-spec-with-rails/.



来源:https://stackoverflow.com/questions/4044461/has-anyone-used-minitestspec-withing-a-rails-functional-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!