Files
danbooru/test/functional/note_versions_controller_test.rb
evazion 0df5c0fd2b Replace deprecated update_attributes with update.
https://rubyinrails.com/2019/04/09/rails-6-1-activerecord-deprecates-update-attributes-methods/

DEPRECATION WARNING: update_attributes! is deprecated and will be removed from Rails 6.1 (please, use update! instead)
2019-08-25 20:29:32 -05:00

37 lines
853 B
Ruby

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)
CurrentUser.scoped(@user_2, "1.2.3.4") do
@note.update(body: "1 2")
end
CurrentUser.scoped(@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