additionals/test/unit/additionals_journal_test.rb

47 lines
1.8 KiB
Ruby
Raw Normal View History

# frozen_string_literal: true
2020-08-08 18:53:49 +03:00
require File.expand_path '../../test_helper', __FILE__
2019-10-11 16:41:46 +03:00
class AdditionalsJournalTest < Additionals::TestCase
fixtures :projects, :users, :members, :member_roles, :roles,
:trackers, :projects_trackers,
:enabled_modules,
:issue_statuses, :issue_categories, :workflows,
:enumerations,
:issues, :journals, :journal_details,
:custom_fields, :custom_fields_projects, :custom_fields_trackers, :custom_values
def setup
prepare_tests
2020-09-07 21:13:50 +03:00
@issue = issues :issues_001
@current_journal = Journal.new journalized: @issue, user: users(:users_001), notes: ''
2019-10-11 16:41:46 +03:00
end
def test_journal_history_with_added_entries
assert_difference 'JournalDetail.count', 2 do
2019-10-11 16:41:46 +03:00
assert AdditionalsJournal.save_journal_history(@current_journal,
'issue_test_relation',
[1],
[1, 2, 3])
end
end
def test_journal_history_with_removed_entries
assert_difference 'JournalDetail.count', 2 do
2019-10-11 16:41:46 +03:00
assert AdditionalsJournal.save_journal_history(@current_journal,
'issue_test_relation',
[1, 2, 3],
[1])
end
end
def test_journal_history_without_changes
assert_no_difference 'JournalDetail.count' do
2019-10-11 16:41:46 +03:00
assert AdditionalsJournal.save_journal_history(@current_journal,
'issue_test_relation',
[1, 2, 3],
[1, 2, 3])
end
end
end