diff --git a/test/system/note_comments_test.rb b/test/system/note_comments_test.rb index 23f3fc98eec..cece1e42d21 100644 --- a/test/system/note_comments_test.rb +++ b/test/system/note_comments_test.rb @@ -1,17 +1,25 @@ -require "application_system_test_case" +require "website_oauth_application_system_test_case" -class NoteCommentsTest < ApplicationSystemTestCase - def test_action_text +class NoteCommentsTest < WebsiteOauthApplicationSystemTestCase + def test_add_comment note = create(:note_with_comments) - sign_in_as(create(:user)) + user = create(:user) + sign_in_as(user) visit note_path(note) + assert_no_content "Comment from #{user.display_name}" + assert_no_content "Some newly added note comment" assert_button "Resolve" assert_button "Comment", :disabled => true - fill_in "text", :with => "Some text" + fill_in "text", :with => "Some newly added note comment" assert_button "Comment & Resolve" - assert_button "Comment" + assert_button "Comment", :disabled => false + + click_button "Comment" + + assert_content "Comment from #{user.display_name}" + assert_content "Some newly added note comment" end end diff --git a/test/website_oauth_application_system_test_case.rb b/test/website_oauth_application_system_test_case.rb new file mode 100644 index 00000000000..c81f2182fb7 --- /dev/null +++ b/test/website_oauth_application_system_test_case.rb @@ -0,0 +1,14 @@ +require "application_system_test_case" + +class WebsiteOauthApplicationSystemTestCase < ApplicationSystemTestCase + def before_setup + super + osm_website_app = create(:oauth_application, :name => "OpenStreetMap Web Site", :scopes => "write_api write_notes") + Settings.oauth_application = osm_website_app.uid + end + + def after_teardown + Settings.reload! + super + end +end