3 class UserDiariesTest < ActionDispatch::IntegrationTest
4 # Test the creation of a diary entry, making sure that you are redirected to
5 # login page when not logged in
6 def test_showing_create_diary_entry
12 # We should now be at the login page
13 assert_response :success
14 assert_template "sessions/new"
16 post "/login", :params => { "username" => user.email, "password" => "test", :referer => "/diary/new" }
17 assert_response :redirect
19 assert_response :success
20 assert_template "diary_entries/new"
22 # We will make sure that the form exists here, full
23 # assert testing of the full form should be done in the
24 # functional tests rather than this integration test
25 # There are some things that are specific to the integratio
26 # that need to be tested, which can't be tested in the functional tests
27 assert_select "div.content-heading", :count => 1 do
28 assert_select "h1", "New Diary Entry"
30 assert_select "div#content" do
31 assert_select "form[action='/diary']" do
32 assert_select "input[id=diary_entry_title]"