3 class UserChangesetCommentsTest < ActionDispatch::IntegrationTest
4 # Test 'log in to comment' message for nonlogged in user
5 def test_log_in_message
6 changeset = create(:changeset, :closed)
8 get "/changeset/#{changeset.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
25 changeset = create(:changeset, :closed)
27 get_via_redirect "/login"
28 # We should now be at the login page
29 assert_response :success
30 assert_template "user/login"
32 post "/login", "username" => user.email, "password" => "test"
33 assert_response :redirect
35 get "/changeset/#{changeset.id}"
37 assert_response :success
38 assert_template "browse/changeset"
40 assert_select "div#content" do
41 assert_select "div#sidebar" do
42 assert_select "div#sidebar_content" do
43 assert_select "div.browse-section" do
44 assert_select "form[action='#']" do
45 assert_select "textarea[name=text]"