]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/diary_entries_controller_test.rb
Drop dummy classes that are unneeded and don't work
[rails.git] / test / controllers / diary_entries_controller_test.rb
index d13a50163ea8bc59e15af03885e25385379ac71a..b6d11c62aff91e69478bfeaa090e181bc3d2708a 100644 (file)
@@ -752,6 +752,28 @@ 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_show_og_image_with_relative_uri
+    user = create(:user)
+    diary_entry = create(:diary_entry, :user => user, :body => "![some local picture](/picture.jpg)")
+
+    get diary_entry_path(user, diary_entry)
+    assert_response :success
+    assert_dom "head meta[property='og:image']" do
+      assert_dom "> @content", "#{root_url}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)