redmine_crm 0.0.33 → 0.0.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5242b016d5072c81150cb2008b3fc7633a96216f
4
- data.tar.gz: b3f77eb78ff97c6c06ef28e57b8d17af8d7f8e34
3
+ metadata.gz: b05a60d81fa656ebd71d75aa3871db0025c63242
4
+ data.tar.gz: 3ce1eb527b7b90f316bf5d0883b8d129b12d5045
5
5
  SHA512:
6
- metadata.gz: ef26d5b1ee5e367ef7240ca961cdeb3bbaaf75b0af6c2c68f779b988302998cd2ee2b69c7a21ac48b22ea18f6ffb141cfa42afb033ca1dc7c0389cd97b395aa4
7
- data.tar.gz: f0779bd48b8225c24411e243b4dcb7a8b17b359e51dc57dd894c57f9388e3dcdc3316edd9ee67fb48b223828246025dc083b2034e157cb02d550c4d2c338dde1
6
+ metadata.gz: 8673d2669a5948e9cc52cf1a294f3d4c6aafa8ff60a3c8346e02ceb03347909b15d5bfb70aa5cca9b7a8e0700f8dd9766924e4612b9cc4beb59e41b5f7d4b3c1
7
+ data.tar.gz: c99defa93349703c1e4bb22c87bb86de377a1c12b073f091e71da2246c64137684aac82d667bb9c6056d62c54ba928a4592f169f298d311605fdbd81c7e0a22d
data/doc/CHANGELOG CHANGED
@@ -4,6 +4,10 @@ Redmine crm gem - general functions for plugins (tags, vote, viewing, currency)
4
4
  Copyright (C) 2011-2017 RedmineUP
5
5
  https://www.redmineup.com/
6
6
 
7
+ == 2017-12-22 v0.0.34
8
+
9
+ * Fixed bug with Redmine 2.x support
10
+
7
11
  == 2017-12-18 v0.0.33
8
12
 
9
13
  * Rails 5 support (Redmine 4)
data/lib/redmine_crm.rb CHANGED
@@ -27,7 +27,7 @@ require 'redmine_crm/helpers/external_assets_helper'
27
27
  require 'redmine_crm/assets_manager'
28
28
 
29
29
  if defined?(ActiveRecord::Base)
30
- ActiveRecord::Base.include(RedmineCrm::ActsAsList::List)
30
+ ActiveRecord::Base.send :include, RedmineCrm::ActsAsList::List
31
31
  ActiveRecord::Base.extend(RedmineCrm::ActsAsVotable::Voter)
32
32
  ActiveRecord::Base.extend(RedmineCrm::ActsAsVotable::Votable)
33
33
  end
@@ -231,10 +231,11 @@ module RedmineCrm
231
231
  # scope(:find)
232
232
 
233
233
  conditions = []
234
- conditions << send(:sanitize_sql, options.delete(:conditions)) if options[:conditions]
235
- conditions << send(:sanitize_sql, scope) if scope
234
+ conditions << send(:sanitize_sql_for_assignment, options.delete(:conditions)) if options[:conditions]
235
+ conditions << send(:sanitize_sql_for_assignment, scope) if scope
236
236
  conditions << "#{Tagging.table_name}.taggable_type = #{quote_string_value(base_class.name)}"
237
237
  conditions << type_condition unless descends_from_active_record?
238
+ conditions.delete('')
238
239
  conditions.compact!
239
240
  conditions = conditions.join(" AND ")
240
241
 
@@ -253,6 +254,7 @@ module RedmineCrm
253
254
  end
254
255
 
255
256
  private
257
+
256
258
  def quote_string_value(object)
257
259
  connection.quote(object)
258
260
  end
@@ -18,8 +18,8 @@ module RedmineCrm
18
18
 
19
19
  scope :up, lambda { where(:vote_flag => true) }
20
20
  scope :down, lambda { where(:vote_flag => false) }
21
- scope :for_type, lambda { |klass| where(:votable_type => klass) }
22
- scope :by_type, lambda { |klass| where(:voter_type => klass) }
21
+ scope :for_type, lambda { |klass| where(:votable_type => klass.to_s) }
22
+ scope :by_type, lambda { |klass| where(:voter_type => klass.to_s) }
23
23
 
24
24
  validates_presence_of :votable_id
25
25
  validates_presence_of :voter_id
@@ -1,3 +1,3 @@
1
1
  module RedmineCrm
2
- VERSION = "0.0.33"
2
+ VERSION = "0.0.34"
3
3
  end
@@ -175,8 +175,8 @@ class RcrmActsAsTaggableTest < ActiveSupport::TestCase
175
175
  options = Issue.find_options_for_tag_counts(:start_at => 2.weeks.ago, :end_at => Date.today)
176
176
  sql = options.values.join(' ')
177
177
 
178
- assert_no_match /taggings/, sql
179
- assert_no_match /tags/, sql
178
+ assert_no_match %r{taggings}, sql
179
+ assert_no_match %r{tags}, sql
180
180
 
181
181
  assert_match /categorisations/, sql
182
182
  assert_match /categories/, sql
@@ -330,7 +330,7 @@ class RcrmActsAsTaggableTest < ActiveSupport::TestCase
330
330
  end
331
331
 
332
332
  def test_quote_value
333
- assert_equal "'RedmineCrm::ActsAsTaggable::Tag'", Issue.send(:quote_value, RedmineCrm::ActsAsTaggable::Tag, nil)
333
+ assert_equal "'RedmineCrm::ActsAsTaggable::Tag'", Issue.send(:quote_value, RedmineCrm::ActsAsTaggable::Tag)
334
334
  end
335
335
 
336
336
  def test_tags_condition
@@ -342,6 +342,6 @@ class RcrmActsAsTaggableTest < ActiveSupport::TestCase
342
342
  issues(:first_issue).tag_list.remove('error')
343
343
  issues(:first_issue).tag_list.add('new')
344
344
  issues(:first_issue).save!
345
- assert_equal %w(question new), issues(:first_issue).all_tags_list
345
+ assert_equal %w(question new), issues(:first_issue).reload.all_tags_list
346
346
  end
347
347
  end
@@ -60,15 +60,6 @@ module RedmineCrm
60
60
  assert_tag_counts Tag.counts(:conditions => ['taggings.created_at >= ?', '2015-01-01']),
61
61
  :question => 3, :error => 2, :feature => 1, :bug => 1
62
62
  end
63
-
64
- def test_all_counts_with_hash_conditions
65
- tag_counts = Tag.counts(
66
- :conditions => {
67
- :taggings => { :created_at => (DateTime.parse('2014-12-31 23:59') .. DateTime.parse('4000-01-01')) }
68
- }
69
- )
70
- assert_tag_counts tag_counts, :question => 3, :error => 2, :feature => 1, :bug => 1
71
- end
72
63
  end
73
64
  end
74
65
  end
@@ -138,7 +138,7 @@ class VoterTest < ActiveSupport::TestCase
138
138
 
139
139
  def test_get_all_of_the_voters_up_votes_for_a_class
140
140
  votable.vote_by(:voter => voter)
141
- votables(:votable2).vote_by( :voter => voter, :vote => false)
141
+ votables(:votable2).vote_by(:voter => voter, :vote => false)
142
142
  assert_equal voter.find_up_votes_for_class(votable_klass).size, 1
143
143
  assert_equal voter.votes.up.for_type(votable_klass).count, 1
144
144
  end
data/test/database.yml CHANGED
@@ -15,3 +15,7 @@ postgresql:
15
15
  :user: container
16
16
  :password: 1
17
17
  :host: localhost
18
+
19
+ default_env:
20
+ adapter: sqlite3
21
+ database: ':memory:'
@@ -12,6 +12,10 @@ class Issue < ActiveRecord::Base
12
12
  def save_without_validation
13
13
  save
14
14
  end
15
+
16
+ def self.quote_value(value)
17
+ connection.quote(value)
18
+ end
15
19
  end
16
20
 
17
21
  class SpecialIssue < Issue
data/test/test_helper.rb CHANGED
@@ -6,10 +6,9 @@ begin
6
6
  require File.dirname(__FILE__) + '/../../../../config/environment'
7
7
  rescue LoadError
8
8
  require 'rubygems'
9
- gem 'activerecord', "4.2.7.1"
10
- gem 'actionpack', "4.2.7.1"
9
+ gem 'activerecord'
10
+ gem 'actionpack'
11
11
  require 'active_record'
12
- # require 'action_controller'
13
12
  end
14
13
  require "redmine_crm"
15
14
  require "active_record/fixtures"
@@ -40,10 +39,10 @@ load(File.dirname(__FILE__) + '/fixtures/project.rb')
40
39
  class ActiveSupport::TestCase #:nodoc:
41
40
  include ActiveRecord::TestFixtures
42
41
 
43
- self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
42
+ self.fixture_path = File.dirname(__FILE__) + '/fixtures/'
44
43
 
45
- self.use_transactional_fixtures = true
46
- self.use_instantiated_fixtures = false
44
+ self.use_transactional_tests = true
45
+ self.use_instantiated_fixtures = false
47
46
  set_fixture_class :tags => RedmineCrm::ActsAsTaggable::Tag
48
47
  set_fixture_class :taggings => RedmineCrm::ActsAsTaggable::Tagging
49
48
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_crm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - RedmineUP
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-18 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid