Skip to content

Commit 073bc86

Browse files
committed
Merge branch 'develop' of hub.georepublic.net:gtt/redmine_text_blocks
2 parents 52294aa + c8a0652 commit 073bc86

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
author 'Jens Krämer, Georepublic'
1010
author_url 'https://hub.georepublic.net/gtt/redmine_text_blocks'
1111
description 'Adds configurable text blocks for replying to issues'
12-
version '1.0.0'
12+
version '1.0.1'
1313

1414
requires_redmine version_or_higher: '3.4.0'
1515

lib/redmine_text_blocks.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
module RedmineTextBlocks
44
def self.setup
5+
RedmineTextBlocks::ProjectPatch.apply
56
ProjectsController.send :helper, RedmineTextBlocks::ProjectSettingsTabs
67
IssuesController.send :helper, TextBlocksHelper
78
end
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module RedmineTextBlocks
2+
module ProjectPatch
3+
def self.apply
4+
Project.class_eval do
5+
has_many :text_blocks, dependent: :delete_all
6+
end
7+
end
8+
end
9+
end

test/unit/text_block_test.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,12 @@ class TextBlockTest < ActiveSupport::TestCase
5454
assert_equal project, r.text_block.project
5555
end
5656
end
57+
58+
test 'deletion of project should delete textblocks' do
59+
RedmineTextBlocks::SaveTextBlock.({name: 'test'}, project: @project)
60+
assert_difference 'TextBlock.count', -1 do
61+
@project.destroy
62+
end
63+
end
5764
end
5865

0 commit comments

Comments
 (0)