Redmine 4.1.1
This commit is contained in:
parent
33e7b881a5
commit
3d976f1b3b
1593 changed files with 36180 additions and 19489 deletions
|
@ -1,5 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2017 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2019 Jean-Philippe Lang
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
|
@ -54,22 +56,24 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||
assert page.save
|
||||
end
|
||||
|
||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||
assert_include 'wiki page has been added', mail_body(ActionMailer::Base.deliveries.last)
|
||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||
ActionMailer::Base.deliveries.each do |mail|
|
||||
assert_include 'wiki page has been added', mail_body(mail)
|
||||
end
|
||||
end
|
||||
|
||||
def test_update_should_be_versioned
|
||||
content = @page.content
|
||||
version_count = content.version
|
||||
content.text = "My new content"
|
||||
assert_difference 'WikiContent::Version.count' do
|
||||
assert_difference 'WikiContentVersion.count' do
|
||||
assert content.save
|
||||
end
|
||||
content.reload
|
||||
assert_equal version_count+1, content.version
|
||||
assert_equal version_count+1, content.versions.length
|
||||
|
||||
version = WikiContent::Version.order('id DESC').first
|
||||
version = WikiContentVersion.order('id DESC').first
|
||||
assert_equal @page.id, version.page_id
|
||||
assert_equal '', version.compression
|
||||
assert_equal "My new content", version.data
|
||||
|
@ -80,12 +84,12 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||
with_settings :wiki_compression => 'gzip' do
|
||||
content = @page.content
|
||||
content.text = "My new content"
|
||||
assert_difference 'WikiContent::Version.count' do
|
||||
assert_difference 'WikiContentVersion.count' do
|
||||
assert content.save
|
||||
end
|
||||
end
|
||||
|
||||
version = WikiContent::Version.order('id DESC').first
|
||||
version = WikiContentVersion.order('id DESC').first
|
||||
assert_equal @page.id, version.page_id
|
||||
assert_equal 'gzip', version.compression
|
||||
assert_not_equal "My new content", version.data
|
||||
|
@ -101,8 +105,10 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||
assert content.save
|
||||
end
|
||||
|
||||
assert_equal 1, ActionMailer::Base.deliveries.size
|
||||
assert_include 'wiki page has been updated', mail_body(ActionMailer::Base.deliveries.last)
|
||||
assert_equal 2, ActionMailer::Base.deliveries.size
|
||||
ActionMailer::Base.deliveries.each do |mail|
|
||||
assert_include 'wiki page has been updated', mail_body(mail)
|
||||
end
|
||||
end
|
||||
|
||||
def test_fetch_history
|
||||
|
@ -128,39 +134,39 @@ class WikiContentTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
def test_previous_for_first_version_should_return_nil
|
||||
content = WikiContent::Version.find_by_page_id_and_version(1, 1)
|
||||
content = WikiContentVersion.find_by_page_id_and_version(1, 1)
|
||||
assert_nil content.previous
|
||||
end
|
||||
|
||||
def test_previous_for_version_should_return_previous_version
|
||||
content = WikiContent::Version.find_by_page_id_and_version(1, 3)
|
||||
content = WikiContentVersion.find_by_page_id_and_version(1, 3)
|
||||
assert_not_nil content.previous
|
||||
assert_equal 2, content.previous.version
|
||||
end
|
||||
|
||||
def test_previous_for_version_with_gap_should_return_previous_available_version
|
||||
WikiContent::Version.find_by_page_id_and_version(1, 2).destroy
|
||||
WikiContentVersion.find_by_page_id_and_version(1, 2).destroy
|
||||
|
||||
content = WikiContent::Version.find_by_page_id_and_version(1, 3)
|
||||
content = WikiContentVersion.find_by_page_id_and_version(1, 3)
|
||||
assert_not_nil content.previous
|
||||
assert_equal 1, content.previous.version
|
||||
end
|
||||
|
||||
def test_next_for_last_version_should_return_nil
|
||||
content = WikiContent::Version.find_by_page_id_and_version(1, 3)
|
||||
content = WikiContentVersion.find_by_page_id_and_version(1, 3)
|
||||
assert_nil content.next
|
||||
end
|
||||
|
||||
def test_next_for_version_should_return_next_version
|
||||
content = WikiContent::Version.find_by_page_id_and_version(1, 1)
|
||||
content = WikiContentVersion.find_by_page_id_and_version(1, 1)
|
||||
assert_not_nil content.next
|
||||
assert_equal 2, content.next.version
|
||||
end
|
||||
|
||||
def test_next_for_version_with_gap_should_return_next_available_version
|
||||
WikiContent::Version.find_by_page_id_and_version(1, 2).destroy
|
||||
WikiContentVersion.find_by_page_id_and_version(1, 2).destroy
|
||||
|
||||
content = WikiContent::Version.find_by_page_id_and_version(1, 1)
|
||||
content = WikiContentVersion.find_by_page_id_and_version(1, 1)
|
||||
assert_not_nil content.next
|
||||
assert_equal 3, content.next.version
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue