• rails g integration_test <NAME>
  • `get ,
    • get search_path, search: “keyword1”
  • Testing XHR (AJAX) requests
    test "ajax request" do
      article = articles(:one)
      get article_url(article), xhr: true
      assert_equal 'hello world', @response.body
      assert_equal "text/javascript", @response.content_type
  end
  
  • Model 생성 / 삭제 / 변경없음 확인

  assert_difference 'Model.count' do
    post ---
  end
  
  • .reload DB의 값을 다시 읽어옴

참고링크