E错误:HomeControllerTest#test_should_get_home:.rb:23:语法错误,意外的输入结束,预期结束

时间:2019-11-27 20:40:16

标签: ruby

require 'test_helper'

class HomeControllerTest < ActionDispatch::IntegrationTest
  test "should get home"do
    get root_url
    assert_response :success

    assert_select 'title', 'My Notes'
    assert_select 'h1', 'My Notes'
    assert_select 'p', 'Welcome to my notes site!'
   end

  test "should get contact"do
    get contact_url
    assert_response :success

    assert_template layout: 'application'

    assert_select 'title', 'My Notes'
    assert_select 'h1', 'Contact Us'
    assert_select 'p', 'Complete the form to get in touch with us.'
   end

  test "should post request contact but no email" do
    post request_contact_url

    assert_response :redirect
    assert_not_empty flash[:alert]
    assert_nil flash[:notice]
   end

  test "should post request contact" do
    post request_contact_url, params:{name: "Matthew", email: "matthew@me.com", telephone: "1234567890", message: "Hello"}

    assert_response :redirect
    assert_nil flash[:alert]
    assert_not_empty flash[:notice]
   end

end

0 个答案:

没有答案