2024-02-25 12:15:55 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "test_helper"
|
2011-01-25 18:13:05 -05:00
|
|
|
|
2018-04-02 13:51:26 -04:00
|
|
|
class NoteVersionsControllerTest < ActionDispatch::IntegrationTest
|
2011-01-25 18:13:05 -05:00
|
|
|
context "The note versions controller" do
|
|
|
|
setup do
|
2018-04-02 13:51:26 -04:00
|
|
|
@user = create(:user)
|
2011-01-25 18:13:05 -05:00
|
|
|
end
|
2013-03-19 08:10:10 -04:00
|
|
|
|
2011-01-25 18:13:05 -05:00
|
|
|
context "index action" do
|
|
|
|
setup do
|
2022-11-26 06:49:35 -05:00
|
|
|
as(@user) do
|
2018-04-02 13:51:26 -04:00
|
|
|
@note = create(:note)
|
|
|
|
end
|
|
|
|
@user_2 = create(:user)
|
2013-03-19 08:10:10 -04:00
|
|
|
|
2022-11-26 09:20:15 -05:00
|
|
|
as(@user_2, "1.2.3.4") do
|
2019-09-09 12:41:47 -04:00
|
|
|
@note.update(:body => "1 2")
|
2011-07-22 18:26:55 -04:00
|
|
|
end
|
2013-03-19 08:10:10 -04:00
|
|
|
|
2022-11-26 09:20:15 -05:00
|
|
|
as(@user, "1.2.3.4") do
|
2019-09-09 12:41:47 -04:00
|
|
|
@note.update(:body => "1 2 3")
|
2011-07-22 18:26:55 -04:00
|
|
|
end
|
2011-01-25 18:13:05 -05:00
|
|
|
end
|
2013-03-19 08:10:10 -04:00
|
|
|
|
2011-01-25 18:13:05 -05:00
|
|
|
should "list all versions" do
|
2018-04-02 13:51:26 -04:00
|
|
|
get note_versions_path
|
2011-01-25 18:13:05 -05:00
|
|
|
assert_response :success
|
|
|
|
end
|
2013-03-19 08:10:10 -04:00
|
|
|
|
2011-01-25 18:13:05 -05:00
|
|
|
should "list all versions that match the search criteria" do
|
2018-04-02 13:51:26 -04:00
|
|
|
get note_versions_path, params: {:search => {:updater_id => @user_2.id}}
|
2011-01-25 18:13:05 -05:00
|
|
|
assert_response :success
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|