rails test provide函数,重构

rails test

test/controllers/static_pages_controller.rb中

test “should get home" do

#get home MVC测试

    get :home

    assert_response :success

#title标签测试

assert_select "title", "Home | Ruby on rails"

end

provice函数

provide(:title,"home")


简化view代码

你可能感兴趣的:(重构,test,Rails)