This commit is contained in:
2025-11-07 13:34:32 -08:00
commit 1e8c5a972b
436 changed files with 11000 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
require "test_helper"
class Books::BookmarksControllerTest < ActionDispatch::IntegrationTest
setup do
sign_in :kevin
end
test "show includes a link to read the last read leaf" do
cookies["reading_progress_#{books(:handbook).id}"] = "#{leaves(:welcome_page).id}/3"
get book_bookmark_url(books(:handbook))
assert_response :success
assert_select "a", /Resume reading/
end
test "show includes a link to start reading if the last read leaf has been trashed" do
leaves(:welcome_page).trashed!
cookies["reading_progress_#{books(:handbook).id}"] = "#{leaves(:welcome_page).id}/3"
get book_bookmark_url(books(:handbook))
assert_response :success
assert_select "a", /Start reading/
end
test "show includes a link to start reading if no reading progress has been recorded" do
get book_bookmark_url(books(:handbook))
assert_response :success
assert_select "a", /Start reading/
end
end