redmine_crm 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/Guardfile +51 -0
- data/LICENSE.txt +339 -0
- data/README.md +57 -0
- data/Rakefile +20 -0
- data/config/currency_iso.json +2516 -0
- data/lib/generators/redmine_crm_migration/redmine_crm_migration_generator.rb +13 -0
- data/lib/generators/redmine_crm_migration/templates/migration.rb +26 -0
- data/lib/redmine_crm.rb +8 -0
- data/lib/redmine_crm/currency.rb +433 -0
- data/lib/redmine_crm/currency/heuristics.rb +151 -0
- data/lib/redmine_crm/currency/loader.rb +24 -0
- data/lib/redmine_crm/rcrm_acts_as_taggable.rb +301 -0
- data/lib/redmine_crm/tag.rb +82 -0
- data/lib/redmine_crm/tag_list.rb +112 -0
- data/lib/redmine_crm/tagging.rb +20 -0
- data/lib/redmine_crm/tags_helper.rb +15 -0
- data/lib/redmine_crm/version.rb +3 -0
- data/redmine_crm.gemspec +30 -0
- data/test/acts_as_taggable_test.rb +384 -0
- data/test/currency_test.rb +292 -0
- data/test/database.yml +17 -0
- data/test/fixtures/issue.rb +9 -0
- data/test/fixtures/issues.yml +12 -0
- data/test/fixtures/taggings.yml +32 -0
- data/test/fixtures/tags.yml +11 -0
- data/test/fixtures/user.rb +3 -0
- data/test/fixtures/users.yml +5 -0
- data/test/schema.rb +25 -0
- data/test/tag_test.rb +64 -0
- data/test/tagging_test.rb +14 -0
- data/test/tags_helper_test.rb +29 -0
- data/test/test_helper.rb +112 -0
- metadata +219 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
# require File.dirname(__FILE__) + '/fixtures/issue'
|
3
|
+
|
4
|
+
class TaggingTest < ActiveSupport::TestCase
|
5
|
+
|
6
|
+
def test_tag
|
7
|
+
assert_equal tags(:error), taggings(:tag_for_error).tag
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_taggable
|
11
|
+
assert_equal issues(:first_issue), taggings(:tag_for_error).taggable
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
|
3
|
+
# module RedmineCrm
|
4
|
+
class TagsHelperTest < ActiveSupport::TestCase
|
5
|
+
include RedmineCrm::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
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
# require 'test/unit'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require File.dirname(__FILE__) + '/../../../../config/environment'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
gem 'activerecord'
|
9
|
+
gem 'actionpack'
|
10
|
+
require 'active_record'
|
11
|
+
# require 'action_controller'
|
12
|
+
end
|
13
|
+
require 'byebug'
|
14
|
+
require "redmine_crm"
|
15
|
+
require "active_record/fixtures"
|
16
|
+
|
17
|
+
require File.dirname(__FILE__) + '/../lib/redmine_crm/rcrm_acts_as_taggable'
|
18
|
+
require File.dirname(__FILE__) + '/../lib/redmine_crm/tag_list'
|
19
|
+
require File.dirname(__FILE__) + '/../lib/redmine_crm/tag'
|
20
|
+
require File.dirname(__FILE__) + '/../lib/redmine_crm/tagging'
|
21
|
+
require File.dirname(__FILE__) + '/../lib/redmine_crm/tags_helper'
|
22
|
+
|
23
|
+
# require_dependency File.dirname(__FILE__) + '/../lib/redmine_crm/tags_helper'
|
24
|
+
|
25
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + '/debug.log')
|
26
|
+
ActiveRecord::Base.configurations = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
27
|
+
ActiveRecord::Base.establish_connection(ENV['DB'] || 'sqlite3')
|
28
|
+
|
29
|
+
load(File.dirname(__FILE__) + '/schema.rb')
|
30
|
+
load(File.dirname(__FILE__) + '/fixtures/issue.rb')
|
31
|
+
load(File.dirname(__FILE__) + '/fixtures/user.rb')
|
32
|
+
|
33
|
+
class ActiveSupport::TestCase #:nodoc:
|
34
|
+
include ActiveRecord::TestFixtures
|
35
|
+
|
36
|
+
self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
37
|
+
|
38
|
+
self.use_transactional_fixtures = true
|
39
|
+
self.use_instantiated_fixtures = false
|
40
|
+
set_fixture_class :tags => RedmineCrm::Tag
|
41
|
+
set_fixture_class :taggings => RedmineCrm::Tagging
|
42
|
+
|
43
|
+
fixtures :all
|
44
|
+
|
45
|
+
def assert_equivalent(expected, actual, message = nil)
|
46
|
+
if expected.first.is_a?(ActiveRecord::Base)
|
47
|
+
assert_equal expected.sort_by(&:id), actual.sort_by(&:id), message
|
48
|
+
else
|
49
|
+
assert_equal expected.sort, actual.sort, message
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def assert_tag_counts(tags, expected_values)
|
54
|
+
# Map the tag fixture names to real tag names
|
55
|
+
expected_values = expected_values.inject({}) do |hash, (tag, count)|
|
56
|
+
hash[tags(tag).name] = count
|
57
|
+
hash
|
58
|
+
end
|
59
|
+
|
60
|
+
tags.each do |tag|
|
61
|
+
value = expected_values.delete(tag.name)
|
62
|
+
|
63
|
+
assert_not_nil value, "Expected count for #{tag.name} was not provided"
|
64
|
+
assert_equal value, tag.count, "Expected value of #{value} for #{tag.name}, but was #{tag.count}"
|
65
|
+
end
|
66
|
+
|
67
|
+
unless expected_values.empty?
|
68
|
+
assert false, "The following tag counts were not present: #{expected_values.inspect}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# def assert_queries(num = 1)
|
73
|
+
# $query_count = 0
|
74
|
+
# yield
|
75
|
+
# ensure
|
76
|
+
# assert_equal num, $query_count, "#{$query_count} instead of #{num} queries were executed."
|
77
|
+
# end
|
78
|
+
|
79
|
+
# def assert_queries(num = 1, options = {})
|
80
|
+
# ignore_none = options.fetch(:ignore_none) { num == :any }
|
81
|
+
# SQLCounter.clear_log
|
82
|
+
# yield
|
83
|
+
# ensure
|
84
|
+
# the_log = ignore_none ? SQLCounter.log_all : SQLCounter.log
|
85
|
+
# if num == :any
|
86
|
+
# assert_operator the_log.size, :>=, 1, "1 or more queries expected, but none were executed."
|
87
|
+
# else
|
88
|
+
# mesg = "#{the_log.size} instead of #{num} queries were executed.#{the_log.size == 0 ? '' : "\nQueries:\n#{the_log.join("\n")}"}"
|
89
|
+
# assert_equal num, the_log.size, mesg
|
90
|
+
# end
|
91
|
+
# end
|
92
|
+
|
93
|
+
def assert_no_queries(&block)
|
94
|
+
assert_queries(0, &block)
|
95
|
+
end
|
96
|
+
|
97
|
+
# From Rails trunk
|
98
|
+
def assert_difference(expressions, difference = 1, message = nil, &block)
|
99
|
+
expression_evaluations = [expressions].flatten.collect{|expression| lambda { eval(expression, block.binding) } }
|
100
|
+
|
101
|
+
original_values = expression_evaluations.inject([]) { |memo, expression| memo << expression.call }
|
102
|
+
yield
|
103
|
+
expression_evaluations.each_with_index do |expression, i|
|
104
|
+
assert_equal original_values[i] + difference, expression.call, message
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def assert_no_difference(expressions, message = nil, &block)
|
109
|
+
assert_difference expressions, 0, message, &block
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
metadata
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redmine_crm
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- RedmineCRM
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activerecord
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: actionpack
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mysql2
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activerecord-mysql-adapter
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: pg
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: plugins for Redmine
|
140
|
+
email:
|
141
|
+
- support@redminecrm.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- Gemfile
|
148
|
+
- Guardfile
|
149
|
+
- LICENSE.txt
|
150
|
+
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- config/currency_iso.json
|
153
|
+
- lib/generators/redmine_crm_migration/redmine_crm_migration_generator.rb
|
154
|
+
- lib/generators/redmine_crm_migration/templates/migration.rb
|
155
|
+
- lib/redmine_crm.rb
|
156
|
+
- lib/redmine_crm/currency.rb
|
157
|
+
- lib/redmine_crm/currency/heuristics.rb
|
158
|
+
- lib/redmine_crm/currency/loader.rb
|
159
|
+
- lib/redmine_crm/rcrm_acts_as_taggable.rb
|
160
|
+
- lib/redmine_crm/tag.rb
|
161
|
+
- lib/redmine_crm/tag_list.rb
|
162
|
+
- lib/redmine_crm/tagging.rb
|
163
|
+
- lib/redmine_crm/tags_helper.rb
|
164
|
+
- lib/redmine_crm/version.rb
|
165
|
+
- redmine_crm.gemspec
|
166
|
+
- test/acts_as_taggable_test.rb
|
167
|
+
- test/currency_test.rb
|
168
|
+
- test/database.yml
|
169
|
+
- test/fixtures/issue.rb
|
170
|
+
- test/fixtures/issues.yml
|
171
|
+
- test/fixtures/taggings.yml
|
172
|
+
- test/fixtures/tags.yml
|
173
|
+
- test/fixtures/user.rb
|
174
|
+
- test/fixtures/users.yml
|
175
|
+
- test/schema.rb
|
176
|
+
- test/tag_test.rb
|
177
|
+
- test/tagging_test.rb
|
178
|
+
- test/tags_helper_test.rb
|
179
|
+
- test/test_helper.rb
|
180
|
+
homepage: ''
|
181
|
+
licenses:
|
182
|
+
- GPL2
|
183
|
+
metadata: {}
|
184
|
+
post_install_message:
|
185
|
+
rdoc_options: []
|
186
|
+
require_paths:
|
187
|
+
- lib
|
188
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - ">="
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0'
|
198
|
+
requirements: []
|
199
|
+
rubyforge_project:
|
200
|
+
rubygems_version: 2.2.2
|
201
|
+
signing_key:
|
202
|
+
specification_version: 4
|
203
|
+
summary: plugins for remine
|
204
|
+
test_files:
|
205
|
+
- test/acts_as_taggable_test.rb
|
206
|
+
- test/currency_test.rb
|
207
|
+
- test/database.yml
|
208
|
+
- test/fixtures/issue.rb
|
209
|
+
- test/fixtures/issues.yml
|
210
|
+
- test/fixtures/taggings.yml
|
211
|
+
- test/fixtures/tags.yml
|
212
|
+
- test/fixtures/user.rb
|
213
|
+
- test/fixtures/users.yml
|
214
|
+
- test/schema.rb
|
215
|
+
- test/tag_test.rb
|
216
|
+
- test/tagging_test.rb
|
217
|
+
- test/tags_helper_test.rb
|
218
|
+
- test/test_helper.rb
|
219
|
+
has_rdoc:
|