3 class UserChangesetCommentsTest < ActionDispatch::IntegrationTest
4 fixtures :users, :changesets, :changeset_comments
6 # Test 'log in to comment' message for nonlogged in user
7 def test_log_in_message
8 get "/changeset/#{changesets(:normal_user_closed_change).id}"
9 assert_response :success
11 assert_select "div#content" do
12 assert_select "div#sidebar" do
13 assert_select "div#sidebar_content" do
14 assert_select "div.browse-section" do
15 assert_select "div.notice.hide_if_logged_in"
22 # Test if the form is shown
23 def test_displaying_form
24 get_via_redirect '/login'
25 # We should now be at the login page
26 assert_response :success
27 assert_template 'user/login'
29 post '/login', {'username' => "test@openstreetmap.org", 'password' => "test"}
30 assert_response :redirect
32 get "/changeset/#{changesets(:normal_user_closed_change).id}"
34 assert_response :success
35 assert_template 'browse/changeset'
37 assert_select "div#content" do
38 assert_select "div#sidebar" do
39 assert_select "div#sidebar_content" do
40 assert_select "div.browse-section" do
41 assert_select "form[action='#']" do
42 assert_select "textarea[name=text]"