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 assert_select "html:root" do
33 assert_select "body" do
34 assert_select "div#content" do
35 assert_select "h1", "New diary entry"
36 assert_select "form" do
37 assert_select "input[id=diary_entry_title]"