Using Minitest in Rails

后端 未结 5 1581
闹比i
闹比i 2020-12-25 13:45

Recently, I\'ve read quite a few articles about Minitest. I really like the idea of a super lightweight test framework. I decided to replace rspec with it in a recent projec

5条回答
  •  我在风中等你
    2020-12-25 14:34

    I'm the author of minitest-rails. Things have changed a lot from the time you originally asked this to now. My answer assumes you're using minitest-rails.

    Named Routes

    If you are using minitest-rails this just works (now). You can use the generators to create these tests, or write them yourself. All the named routes are available in your acceptance/integration tests.

    require "minitest_helper"
    
    describe "Homepage Acceptance Test" do
      it "must load successfully" do
        get root_path
        assert_response :success
      end
    end
    

    Adoption

    I think we will continue to see increased attention on using Minitest with Rails as we get closer to Rails 4.

    Worth it?

    I think starting with Minitest now is totally worth it. There is tremendous activity going on in Minitest right now. It aligns nicely with the recent focus on fast tests as well. But it really depends on your app and team dynamics.

提交回复
热议问题