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" do
16 assert_select "a[href='/login?referer=%2Fchangeset%2F#{changeset.id}']", :text => I18n.t("browse.changeset.join_discussion"), :count => 1
24 # Test if the form is shown
25 def test_displaying_form
27 changeset = create(:changeset, :closed)
31 # We should now be at the login page
32 assert_response :success
33 assert_template "users/login"
35 post "/login", :params => { "username" => user.email, "password" => "test" }
36 assert_response :redirect
38 get "/changeset/#{changeset.id}"
40 assert_response :success
41 assert_template "browse/changeset"
43 assert_select "div#content" do
44 assert_select "div#sidebar" do
45 assert_select "div#sidebar_content" do
46 assert_select "div.browse-section" do
47 assert_select "form[action='#']" do
48 assert_select "textarea[name=text]"