Fix handling of title when replying to diary entries

This commit is contained in:
Andy Allan 2018-04-11 14:03:17 +08:00
parent fc90b73581
commit 0a86a1ea8d
5 changed files with 30 additions and 4 deletions

View file

@ -0,0 +1,18 @@
require "application_system_test_case"
class DiaryEntryTest < ApplicationSystemTestCase
def setup
create(:language, :code => "en")
@diary_entry = create(:diary_entry)
end
test "reply to diary entry should prefill the message subject" do
sign_in_as(create(:user))
visit diary_path
click_on "Reply to this entry"
assert page.has_content? "Send a new message"
assert_equal "Re: #{@diary_entry.title}", page.find_field("Subject").value
end
end

View file

@ -150,5 +150,13 @@ module ActiveSupport
end
end
end
def sign_in_as(user)
stub_hostip_requests
visit login_path
fill_in "username", :with => user.email
fill_in "password", :with => "test"
click_on "Login", :match => :first
end
end
end