]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/diary_entries_controller_test.rb
Set Open Graph image to first image for diary entries
[rails.git] / test / controllers / diary_entries_controller_test.rb
index d13a50163ea8bc59e15af03885e25385379ac71a..765391d24584eb3de83a343cff3e91632eb03392 100644 (file)
@@ -752,6 +752,17 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
     end
   end
 
     end
   end
 
+  def test_show_og_image
+    user = create(:user)
+    diary_entry = create(:diary_entry, :user => user, :body => "![some picture](https://example.com/picture.jpg)")
+
+    get diary_entry_path(user, diary_entry)
+    assert_response :success
+    assert_dom "head meta[property='og:image']" do
+      assert_dom "> @content", "https://example.com/picture.jpg"
+    end
+  end
+
   def test_hide
     user = create(:user)
     diary_entry = create(:diary_entry, :user => user)
   def test_hide
     user = create(:user)
     diary_entry = create(:diary_entry, :user => user)