eBooru/test/functional/note_versions_controller_test.rb
Earlopain fc7d84affd
[RuboCop] Enable Style/FrozenStringLiteralComment
This reduces allocations on the posts page by about 5%, from basic testing
2024-02-25 18:15:55 +01:00

39 lines
860 B
Ruby

# frozen_string_literal: true
require "test_helper"
class NoteVersionsControllerTest < ActionDispatch::IntegrationTest
context "The note versions controller" do
setup do
@user = create(:user)
end
context "index action" do
setup do
as(@user) do
@note = create(:note)
end
@user_2 = create(:user)
as(@user_2, "1.2.3.4") do
@note.update(:body => "1 2")
end
as(@user, "1.2.3.4") do
@note.update(:body => "1 2 3")
end
end
should "list all versions" do
get note_versions_path
assert_response :success
end
should "list all versions that match the search criteria" do
get note_versions_path, params: {:search => {:updater_id => @user_2.id}}
assert_response :success
end
end
end
end