1 require File.dirname(__FILE__) + '/../test_helper'
3 class UserDiariesTest < ActionController::IntegrationTest
4 fixtures :users, :diary_entries
6 def test_showing_create_diary_entry
7 get_via_redirect '/user/test/diary/new'
8 # We should now be at the login page
9 assert_response :success
10 assert_template 'user/login'
12 post '/login', {'user[email]' => "test@openstreetmap.org", 'user[password]' => "test", :referer => '/user/test/diary/new'}
13 assert_response :redirect
15 # Check that there is some payload alerting the user to the redirect
16 # and allowing them to get to the page they are being directed to
17 assert_select "html:root" do
18 assert_select "body" do
19 assert_select "a[href='http://www.example.com/user/test/diary/new']"
22 # Required due to a bug in the rails testing framework
23 # http://markmail.org/message/wnslvi5xv5moqg7g
27 assert_response :success
28 assert_template 'diary_entry/edit'
30 #print @html_document.to_yaml
32 # We will make sure that the form exists here, full
33 # assert testing of the full form should be done in the
34 # functional tests rather than this integration test
35 # There are some things that are specific to the integratio
36 # that need to be tested, which can't be tested in the functional tests
37 assert_select "html:root" do
38 assert_select "body" do
39 assert_select "div#content" do
40 assert_select "h1", "New diary entry"
41 assert_select "form[action='/user/#{users(:normal_user).display_name}/diary/new']" do
42 assert_select "input[id=diary_entry_title]"