assert_select "li.page-item.disabled span.page-link", :text => "Newer Entries", :count => 1
end
+ def test_index_invalid_paged
+ # Try some invalid paged accesses
+ %w[-1 0 fred].each do |id|
+ get diary_entries_path(:before => id)
+ assert_redirected_to :controller => :errors, :action => :bad_request
+
+ get diary_entries_path(:after => id)
+ assert_redirected_to :controller => :errors, :action => :bad_request
+ end
+ end
+
def test_rss
create(:language, :code => "de")
create(:diary_entry, :language_code => "en")
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)
assert_response :not_found
end
+ def test_comments_invalid_paged
+ user = create(:user)
+
+ %w[-1 0 fred].each do |id|
+ get diary_comments_path(:display_name => user.display_name, :before => id)
+ assert_redirected_to :controller => :errors, :action => :bad_request
+
+ get diary_comments_path(:display_name => user.display_name, :after => id)
+ assert_redirected_to :controller => :errors, :action => :bad_request
+ end
+ end
+
def test_subscribe_page
user = create(:user)
other_user = create(:user)