:longitude => "2.2", :language_code => "en" })
end
assert_redirected_to :action => :index, :display_name => user.display_name
- entry = DiaryEntry.order(:id).last
+ entry = DiaryEntry.last
assert_equal user.id, entry.user_id
assert_equal "New Title", entry.title
assert_equal "This is a new body for the diary entry", entry.body
:longitude => "2.2", :language_code => "de" })
end
assert_redirected_to :action => :index, :display_name => user.display_name
- entry = DiaryEntry.order(:id).last
+ entry = DiaryEntry.last
assert_equal user.id, entry.user_id
assert_equal "New Title", entry.title
assert_equal "This is a new body for the diary entry", entry.body
:diary_entry => { :title => spammy_title, :body => spammy_body, :language_code => "en" })
end
assert_redirected_to :action => :index, :display_name => user.display_name
- entry = DiaryEntry.order(:id).last
+ entry = DiaryEntry.last
assert_equal user.id, entry.user_id
assert_equal spammy_title, entry.title
assert_equal spammy_body, entry.body
end
end
+ def test_show_og_title
+ user = create(:user)
+ diary_entry = create(:diary_entry, :user => user, :title => "The Important Blog Post")
+
+ get diary_entry_path(user, diary_entry)
+ assert_response :success
+ assert_dom "head meta[property='og:title']" do
+ assert_dom "> @content", "The Important Blog Post"
+ end
+ end
+
def test_show_og_image_with_no_image
user = create(:user)
diary_entry = create(:diary_entry, :user => user, :body => "nothing")
end
end
+ def test_show_article_published_time
+ user = create(:user)
+ diary_entry = create(:diary_entry, :user => user, :created_at => "2020-03-04")
+
+ get diary_entry_path(user, diary_entry)
+ assert_response :success
+ assert_dom "head meta[property='article:published_time']" do
+ assert_dom "> @content", "2020-03-04T00:00:00Z"
+ end
+ end
+
def test_hide
user = create(:user)
diary_entry = create(:diary_entry, :user => user)