redmineup 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/Gemfile +4 -0
  4. data/README.md +204 -0
  5. data/Rakefile +11 -0
  6. data/app/controllers/redmineup_controller.rb +26 -0
  7. data/app/views/redmine_crm/redmineup_calendar/_calendar.html.erb +34 -0
  8. data/app/views/redmineup/_money.html.erb +44 -0
  9. data/app/views/redmineup/settings.html.erb +10 -0
  10. data/bitbucket-pipelines.yml +50 -0
  11. data/config/currency_iso.json +2544 -0
  12. data/config/locales/cs.yml +13 -0
  13. data/config/locales/de.yml +13 -0
  14. data/config/locales/en.yml +13 -0
  15. data/config/locales/es.yml +13 -0
  16. data/config/locales/ru.yml +13 -0
  17. data/config/routes.rb +5 -0
  18. data/doc/CHANGELOG +14 -0
  19. data/doc/LICENSE.txt +339 -0
  20. data/lib/redmineup/acts_as_draftable/draft.rb +40 -0
  21. data/lib/redmineup/acts_as_draftable/up_acts_as_draftable.rb +172 -0
  22. data/lib/redmineup/acts_as_list/list.rb +282 -0
  23. data/lib/redmineup/acts_as_priceable/up_acts_as_priceable.rb +33 -0
  24. data/lib/redmineup/acts_as_taggable/tag.rb +81 -0
  25. data/lib/redmineup/acts_as_taggable/tag_list.rb +111 -0
  26. data/lib/redmineup/acts_as_taggable/tagging.rb +16 -0
  27. data/lib/redmineup/acts_as_taggable/up_acts_as_taggable.rb +357 -0
  28. data/lib/redmineup/acts_as_viewed/up_acts_as_viewed.rb +274 -0
  29. data/lib/redmineup/acts_as_votable/up_acts_as_votable.rb +80 -0
  30. data/lib/redmineup/acts_as_votable/up_acts_as_voter.rb +20 -0
  31. data/lib/redmineup/acts_as_votable/votable.rb +323 -0
  32. data/lib/redmineup/acts_as_votable/vote.rb +28 -0
  33. data/lib/redmineup/acts_as_votable/voter.rb +131 -0
  34. data/lib/redmineup/assets_manager.rb +43 -0
  35. data/lib/redmineup/colors_helper.rb +192 -0
  36. data/lib/redmineup/compatibility/application_controller_patch.rb +33 -0
  37. data/lib/redmineup/compatibility/routing_mapper_patch.rb +25 -0
  38. data/lib/redmineup/currency/formatting.rb +224 -0
  39. data/lib/redmineup/currency/heuristics.rb +151 -0
  40. data/lib/redmineup/currency/loader.rb +23 -0
  41. data/lib/redmineup/currency.rb +450 -0
  42. data/lib/redmineup/engine.rb +4 -0
  43. data/lib/redmineup/helpers/external_assets_helper.rb +20 -0
  44. data/lib/redmineup/helpers/form_tag_helper.rb +88 -0
  45. data/lib/redmineup/helpers/rup_calendar_helper.rb +146 -0
  46. data/lib/redmineup/helpers/tags_helper.rb +13 -0
  47. data/lib/redmineup/helpers/vote_helper.rb +35 -0
  48. data/lib/redmineup/hooks/views_layouts_hook.rb +11 -0
  49. data/lib/redmineup/liquid/drops/attachment_drop.rb +47 -0
  50. data/lib/redmineup/liquid/drops/issue_relations_drop.rb +41 -0
  51. data/lib/redmineup/liquid/drops/issues_drop.rb +217 -0
  52. data/lib/redmineup/liquid/drops/news_drop.rb +54 -0
  53. data/lib/redmineup/liquid/drops/projects_drop.rb +86 -0
  54. data/lib/redmineup/liquid/drops/time_entries_drop.rb +65 -0
  55. data/lib/redmineup/liquid/drops/users_drop.rb +68 -0
  56. data/lib/redmineup/liquid/filters/arrays.rb +254 -0
  57. data/lib/redmineup/liquid/filters/base.rb +249 -0
  58. data/lib/redmineup/liquid/filters/colors.rb +31 -0
  59. data/lib/redmineup/money_helper.rb +66 -0
  60. data/lib/redmineup/patches/liquid_patch.rb +33 -0
  61. data/lib/redmineup/settings/money.rb +46 -0
  62. data/lib/redmineup/settings.rb +53 -0
  63. data/lib/redmineup/version.rb +3 -0
  64. data/lib/redmineup.rb +108 -0
  65. data/redmineup.gemspec +29 -0
  66. data/test/acts_as_draftable/draft_test.rb +29 -0
  67. data/test/acts_as_draftable/rup_acts_as_draftable_test.rb +178 -0
  68. data/test/acts_as_taggable/rup_acts_as_taggable_test.rb +350 -0
  69. data/test/acts_as_taggable/tag_list_test.rb +34 -0
  70. data/test/acts_as_taggable/tag_test.rb +72 -0
  71. data/test/acts_as_taggable/tagging_test.rb +15 -0
  72. data/test/acts_as_viewed/rup_acts_as_viewed_test.rb +47 -0
  73. data/test/acts_as_votable/rup_acts_as_votable_test.rb +19 -0
  74. data/test/acts_as_votable/rup_acts_as_voter_test.rb +14 -0
  75. data/test/acts_as_votable/votable_test.rb +507 -0
  76. data/test/acts_as_votable/voter_test.rb +296 -0
  77. data/test/currency_test.rb +292 -0
  78. data/test/database.yml +17 -0
  79. data/test/fixtures/attachments.yml +14 -0
  80. data/test/fixtures/issues.yml +24 -0
  81. data/test/fixtures/news.yml +8 -0
  82. data/test/fixtures/projects.yml +10 -0
  83. data/test/fixtures/taggings.yml +32 -0
  84. data/test/fixtures/tags.yml +11 -0
  85. data/test/fixtures/users.yml +9 -0
  86. data/test/fixtures/votable_caches.yml +2 -0
  87. data/test/fixtures/votables.yml +4 -0
  88. data/test/fixtures/voters.yml +6 -0
  89. data/test/liquid/drops/attachment_drop_test.rb +15 -0
  90. data/test/liquid/drops/issue_relations_drop_test.rb +24 -0
  91. data/test/liquid/drops/issues_drop_test.rb +38 -0
  92. data/test/liquid/drops/news_drop_test.rb +38 -0
  93. data/test/liquid/drops/projects_drop_test.rb +44 -0
  94. data/test/liquid/drops/uses_drop_test.rb +36 -0
  95. data/test/liquid/filters/arrays_filter_test.rb +31 -0
  96. data/test/liquid/filters/base_filter_test.rb +67 -0
  97. data/test/liquid/filters/colors_filter_test.rb +33 -0
  98. data/test/liquid/liquid_helper.rb +34 -0
  99. data/test/models/attachment.rb +3 -0
  100. data/test/models/issue.rb +21 -0
  101. data/test/models/issue_relation.rb +10 -0
  102. data/test/models/news.rb +3 -0
  103. data/test/models/project.rb +8 -0
  104. data/test/models/user.rb +11 -0
  105. data/test/models/vote_classes.rb +33 -0
  106. data/test/money_helper_test.rb +12 -0
  107. data/test/schema.rb +144 -0
  108. data/test/tags_helper_test.rb +29 -0
  109. data/test/test_helper.rb +66 -0
  110. data/test/vote_helper_test.rb +28 -0
  111. data/vendor/assets/images/money.png +0 -0
  112. data/vendor/assets/images/vcard.png +0 -0
  113. data/vendor/assets/javascripts/Chart.bundle.min.js +16 -0
  114. data/vendor/assets/javascripts/select2.js +2 -0
  115. data/vendor/assets/javascripts/select2_helpers.js +192 -0
  116. data/vendor/assets/stylesheets/money.css +96 -0
  117. data/vendor/assets/stylesheets/select2.css +424 -0
  118. metadata +295 -0
@@ -0,0 +1,29 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ # module Redmineup
4
+ class TagsHelperTest < ActiveSupport::TestCase
5
+ include Redmineup::TagsHelper
6
+
7
+ def test_tag_cloud
8
+ cloud_elements = []
9
+
10
+ tag_cloud Issue.tag_counts, %w(css1 css2 css3 css4) do |tag, css_class|
11
+ cloud_elements << [tag, css_class]
12
+ end
13
+ assert cloud_elements.include?([tags(:error), "css4"])
14
+ assert cloud_elements.include?([tags(:question), "css4"])
15
+ assert cloud_elements.include?([tags(:bug), "css2"])
16
+ assert cloud_elements.include?([tags(:feature), "css2"])
17
+ assert_equal 4, cloud_elements.size
18
+ end
19
+
20
+ # def test_tag_cloud_when_no_tags
21
+ # cloud_elements = []
22
+ # tag_cloud SpecialIssue.tag_counts, %w(css1) do |tag, css_class|
23
+ # # assert false, "tag_cloud should not yield"
24
+ # cloud_elements << [tag, css_class]
25
+ # end
26
+ # assert_equal 0, cloud_elements.size
27
+ # end
28
+ end
29
+ # end
@@ -0,0 +1,66 @@
1
+ require 'rails/all'
2
+ require 'redmineup'
3
+ require 'minitest/autorun'
4
+
5
+ ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
6
+ ActiveRecord::Base.configurations = YAML.load_file(File.dirname(__FILE__) + '/database.yml')
7
+ ActiveRecord::Base.establish_connection(ENV['DB'].try(:to_sym) || :sqlite)
8
+
9
+ load(File.dirname(__FILE__) + '/schema.rb')
10
+ Dir.glob(File.expand_path('../models/*.rb', __FILE__)).each { |f| require f }
11
+
12
+ class ActiveSupport::TestCase #:nodoc:
13
+ include ActiveRecord::TestFixtures
14
+
15
+ self.fixture_path = File.dirname(__FILE__) + '/fixtures/'
16
+
17
+ self.use_transactional_tests = true if RUBY_VERSION > '1.9.3'
18
+ self.use_instantiated_fixtures = false
19
+ set_fixture_class :tags => Redmineup::ActsAsTaggable::Tag
20
+ set_fixture_class :taggings => Redmineup::ActsAsTaggable::Tagging
21
+
22
+ set_fixture_class :votable_caches => VotableCache
23
+ fixtures :all
24
+
25
+ def assert_equivalent(expected, actual, message = nil)
26
+ if expected.first.is_a?(ActiveRecord::Base)
27
+ assert_equal expected.sort_by(&:id), actual.sort_by(&:id), message
28
+ else
29
+ assert_equal expected.sort, actual.sort, message
30
+ end
31
+ end
32
+
33
+ def assert_tag_counts(tags, expected_values)
34
+ # Map the tag fixture names to real tag names
35
+ expected_values = expected_values.inject({}) do |hash, (tag, count)|
36
+ hash[tags(tag).name] = count
37
+ hash
38
+ end
39
+
40
+ tags.each do |tag|
41
+ value = expected_values.delete(tag.name)
42
+
43
+ assert_not_nil value, "Expected count for #{tag.name} was not provided"
44
+ assert_equal value, tag.count, "Expected value of #{value} for #{tag.name}, but was #{tag.count}"
45
+ end
46
+
47
+ unless expected_values.empty?
48
+ assert false, "The following tag counts were not present: #{expected_values.inspect}"
49
+ end
50
+ end
51
+
52
+ # From Rails trunk
53
+ def assert_difference(expressions, difference = 1, message = nil, &block)
54
+ expression_evaluations = [expressions].flatten.collect{ |expression| lambda { eval(expression, block.binding) } }
55
+
56
+ original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call }
57
+ yield
58
+ expression_evaluations.each_with_index do |expression, i|
59
+ assert_equal original_values[i] + difference, expression.call, message
60
+ end
61
+ end
62
+
63
+ def assert_no_difference(expressions, message = nil, &block)
64
+ assert_difference expressions, 0, message, &block
65
+ end
66
+ end
@@ -0,0 +1,28 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class VoteHelperTest < ActiveSupport::TestCase
4
+ def vote
5
+ Redmineup::ActsAsVotable::Vote.new
6
+ end
7
+
8
+ def test_know_that_like_is_a_true_vote
9
+ assert vote.votable_words.that_mean_true.include? "like"
10
+ end
11
+
12
+ def test_know_that_bad_is_a_false_vote
13
+ assert vote.votable_words.that_mean_false.include? "bad"
14
+ end
15
+
16
+ def test_be_a_vote_for_true_when_word_is_good
17
+ assert vote.votable_words.meaning_of('good')
18
+ end
19
+
20
+ def test_be_a_vote_for_false_when_word_is_down
21
+ assert !vote.votable_words.meaning_of('down')
22
+ end
23
+
24
+ def test_be_a_vote_for_true_when_the_word_is_unknown
25
+ assert vote.votable_words.meaning_of('lsdhklkadhfs')
26
+ end
27
+
28
+ end
Binary file
Binary file