dimanche 27 mars 2016

What does the assert_template mean in Micheal Harl's ruby on rails listing 8.7

Hi I'm following the Micheal Harl's ruby on rails tutorial and when I reach chapter 6, things get a bit confusing to me. Now I'm a bit confused about the test codes in listing 8.7 below:

require 'test_helper'

class UsersLoginTest < ActionDispatch::IntegrationTest

  test 'login with invalid information' do
    get login_path
    assert_template 'sessions/new'
    post login_path, session: { email: "", password: "" }
    assert_template 'sessions/new'
    assert_not flash.empty?
    get root_path
    assert flash.empty?
  end
end

The codes above is to catch unwanted flash error message persistence issue. but I'm not so sure where does the assert_template come from...If I can get some explanation about all lines of codes above, that'd be very much appreciated!

Thank you very much and I'm looking forward to your answers.

Aucun commentaire:

Enregistrer un commentaire