redmineup 1.1.2 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,16 +34,19 @@ class TagTest < ActiveSupport::TestCase
34
34
  end
35
35
 
36
36
  def test_color
37
- colors = %w(#aaaaaa #bbbbbb)
38
- colorized = [tags(:bug), tags(:feature)]
39
- colorized.each do |tag|
40
- assert_equal colors.include?(tag.color), true
41
- end
37
+ assert_equal '#aaaaaa', tags(:feature).color # 11184810 = 0xaaaaaa
38
+ assert_equal '#bbbbbb', tags(:bug).color # 12303291 = 0xbbbbbb
39
+ # no DB color — falls back to color_from_name, not nil
40
+ assert_equal Redmineup::ActsAsTaggable::Tag.color_from_name('error'), tags(:error).color
41
+ assert_equal Redmineup::ActsAsTaggable::Tag.color_from_name('question'), tags(:question).color
42
+ end
42
43
 
43
- not_colorized = [tags(:error), tags(:question)]
44
- not_colorized.each do |tag|
45
- assert_nil tag.color
46
- end
44
+ def test_color_from_name
45
+ color = Redmineup::ActsAsTaggable::Tag.color_from_name('error')
46
+ assert_match(/\A#[0-9a-f]{6}\z/, color)
47
+ assert_equal color, Redmineup::ActsAsTaggable::Tag.color_from_name('error') # deterministic
48
+ assert_not_equal color, Redmineup::ActsAsTaggable::Tag.color_from_name('other')
49
+ assert_match(/\A#[0-9a-f]{6}\z/, Redmineup::ActsAsTaggable::Tag.color_from_name(nil))
47
50
  end
48
51
 
49
52
  def test_tag_is_equal_to_itself
@@ -0,0 +1,41 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class TagsHelperViewTest < ActionView::TestCase
4
+ include Redmineup::TagsHelper
5
+ include Redmineup::FormTagHelper
6
+
7
+ def stub_tag_url(name)
8
+ "/stub_tags/#{name}" # URL stub for tag_cloud_links(tags, :stub)
9
+ end
10
+
11
+ def test_tag_link
12
+ result = tag_link('/tags/error', 'error', count: 3)
13
+ assert_includes result, 'tag-label-color'
14
+ assert_includes result, 'background-color: #'
15
+ assert_includes result, '(3)'
16
+ end
17
+
18
+ def test_tag_links
19
+ result = tag_links(['error', 'bug']) { |t| "/tags/#{t}" }
20
+ assert_includes result, 'class="tag_list"'
21
+ assert_nil tag_links([]) { |t| "/tags/#{t}" }
22
+ end
23
+
24
+ def test_tag_cloud_links
25
+ result = tag_cloud_links(Issue.tag_counts, :stub)
26
+ assert_includes result, 'class="tag_list"'
27
+ assert_includes result, '/stub_tags/'
28
+ assert_nil tag_cloud_links([], :stub)
29
+ assert_raises(NoMethodError) { tag_cloud_links(Issue.tag_counts, :unknown_xyz) }
30
+ end
31
+
32
+ def test_tag_list_field_tag
33
+ result = tag_list_field_tag('issue[tag_list]', ['bug'],
34
+ url: '/auto_completes/taggable_tags',
35
+ width: '60%', tags: false,
36
+ placeholder: '+ add tag')
37
+ assert_includes result, 'name="issue[tag_list][]"'
38
+ assert_includes result, '"width":"60%"'
39
+ assert_includes result, '"tags":false'
40
+ end
41
+ end
data/test/test_helper.rb CHANGED
@@ -1,25 +1,27 @@
1
1
  require 'rails/all'
2
2
  require 'redmineup'
3
3
  require 'minitest/autorun'
4
+ require 'minitest/mock'
4
5
 
5
6
  ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
6
7
  ActiveRecord::Base.configurations = YAML.load_file(File.dirname(__FILE__) + '/database.yml')
7
8
  ActiveRecord::Base.establish_connection(ENV['DB'].try(:to_sym) || :sqlite)
8
9
 
9
10
  load(File.dirname(__FILE__) + '/schema.rb')
10
- Dir.glob(File.expand_path('../models/*.rb', __FILE__)).each { |f| require f }
11
+ Dir.glob(File.expand_path('models/*.rb', __dir__)).each { |f| require f }
11
12
 
12
- class ActiveSupport::TestCase #:nodoc:
13
+ class ActiveSupport::TestCase # :nodoc:
13
14
  include ActiveRecord::TestFixtures
14
15
 
15
- self.fixture_path = File.dirname(__FILE__) + '/fixtures/'
16
+ gem_fixtures_path = File.dirname(__FILE__) + '/fixtures/'
17
+ respond_to?(:fixture_paths=) ? self.fixture_paths = [gem_fixtures_path] : self.fixture_path = gem_fixtures_path
16
18
 
17
19
  self.use_transactional_tests = true if RUBY_VERSION > '1.9.3'
18
20
  self.use_instantiated_fixtures = false
19
- set_fixture_class :tags => Redmineup::ActsAsTaggable::Tag
20
- set_fixture_class :taggings => Redmineup::ActsAsTaggable::Tagging
21
+ set_fixture_class tags: Redmineup::ActsAsTaggable::Tag
22
+ set_fixture_class taggings: Redmineup::ActsAsTaggable::Tagging
21
23
 
22
- set_fixture_class :votable_caches => VotableCache
24
+ set_fixture_class votable_caches: VotableCache
23
25
  fixtures :all
24
26
 
25
27
  def assert_equivalent(expected, actual, message = nil)
@@ -32,9 +34,8 @@ class ActiveSupport::TestCase #:nodoc:
32
34
 
33
35
  def assert_tag_counts(tags, expected_values)
34
36
  # Map the tag fixture names to real tag names
35
- expected_values = expected_values.inject({}) do |hash, (tag, count)|
37
+ expected_values = expected_values.each_with_object({}) do |(tag, count), hash|
36
38
  hash[tags(tag).name] = count
37
- hash
38
39
  end
39
40
 
40
41
  tags.each do |tag|
@@ -44,14 +45,14 @@ class ActiveSupport::TestCase #:nodoc:
44
45
  assert_equal value, tag.count, "Expected value of #{value} for #{tag.name}, but was #{tag.count}"
45
46
  end
46
47
 
47
- unless expected_values.empty?
48
- assert false, "The following tag counts were not present: #{expected_values.inspect}"
49
- end
48
+ return if expected_values.empty?
49
+
50
+ assert false, "The following tag counts were not present: #{expected_values.inspect}"
50
51
  end
51
52
 
52
53
  # From Rails trunk
53
54
  def assert_difference(expressions, difference = 1, message = nil, &block)
54
- expression_evaluations = [expressions].flatten.collect{ |expression| lambda { eval(expression, block.binding) } }
55
+ expression_evaluations = [expressions].flatten.collect { |expression| -> { eval(expression, block.binding) } }
55
56
 
56
57
  original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call }
57
58
  yield
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmineup
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-11-07 00:00:00.000000000 Z
11
+ date: 2026-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -123,8 +123,10 @@ files:
123
123
  - app/assets/javascripts/select2_helpers.js
124
124
  - app/assets/stylesheets/calendars.css
125
125
  - app/assets/stylesheets/money.css
126
+ - app/assets/stylesheets/redmineup.css
126
127
  - app/assets/stylesheets/select2.css
127
128
  - app/controllers/redmineup_controller.rb
129
+ - app/views/redmineup/_additional_assets.html.erb
128
130
  - app/views/redmineup/_money.html.erb
129
131
  - app/views/redmineup/settings.html.erb
130
132
  - config/currency_iso.json
@@ -136,6 +138,9 @@ files:
136
138
  - config/routes.rb
137
139
  - doc/CHANGELOG
138
140
  - doc/LICENSE.txt
141
+ - doc/active-record-mixins.md
142
+ - doc/assets-money-and-utilities.md
143
+ - doc/tagging-and-select2.md
139
144
  - lib/action_cable/server/rup_configuration.rb
140
145
  - lib/action_cable/server/rup_server.rb
141
146
  - lib/application_record.rb
@@ -162,6 +167,7 @@ files:
162
167
  - lib/redmineup/currency/loader.rb
163
168
  - lib/redmineup/engine.rb
164
169
  - lib/redmineup/helpers/calendars_helper.rb
170
+ - lib/redmineup/helpers/datetime_helper.rb
165
171
  - lib/redmineup/helpers/external_assets_helper.rb
166
172
  - lib/redmineup/helpers/form_tag_helper.rb
167
173
  - lib/redmineup/helpers/tags_helper.rb
@@ -183,6 +189,7 @@ files:
183
189
  - lib/redmineup/money_helper.rb
184
190
  - lib/redmineup/patches/action_cable_base_patch.rb
185
191
  - lib/redmineup/patches/action_cable_patch.rb
192
+ - lib/redmineup/patches/auto_completes_controller_patch.rb
186
193
  - lib/redmineup/patches/compatibility/application_controller_patch.rb
187
194
  - lib/redmineup/patches/compatibility/routing_mapper_patch.rb
188
195
  - lib/redmineup/patches/compatibility/sprite_patch.rb
@@ -238,6 +245,7 @@ files:
238
245
  - test/money_helper_test.rb
239
246
  - test/schema.rb
240
247
  - test/tags_helper_test.rb
248
+ - test/tags_helper_view_test.rb
241
249
  - test/test_helper.rb
242
250
  - test/vote_helper_test.rb
243
251
  homepage: https://www.redmineup.com
@@ -309,5 +317,6 @@ test_files:
309
317
  - test/money_helper_test.rb
310
318
  - test/schema.rb
311
319
  - test/tags_helper_test.rb
320
+ - test/tags_helper_view_test.rb
312
321
  - test/test_helper.rb
313
322
  - test/vote_helper_test.rb