HornsAndHooves-moribus 0.5.1 → 0.6.0

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
  SHA256:
3
- metadata.gz: 69f7a6978f05898888e7ef3e11471ea7606eb5211ffd7f098158bd67eec829a3
4
- data.tar.gz: 6ac6db71051f8800f447e3dcd827abee37181754aa2f32e9ffddfd9e698392e4
3
+ metadata.gz: 664930f1565d0d6eaa50dc8fba6c3f90763e70c709a748f2e572f493ef2f3de5
4
+ data.tar.gz: b9541ec330424313c0e71f9605af2f2cf615d6df92b2a29961a97675cc457683
5
5
  SHA512:
6
- metadata.gz: eec5927604715080d2fd3ae72b71da0dfc4169de6949507904426f87e7a75768e4b953e07ce3efa46dfd0109fb66b743fa8e86abbb961d9ec2b971fbff480a16
7
- data.tar.gz: 60f7975b1ad8f4818fade8a5a8f9c68d89d9244d586f6d89b6033a53fe47b7aa748378b777c9f5caa345dd90286a997f9f89d3f585901ae9f9a2c3a98427b611
6
+ metadata.gz: 5af699607d6d67710af3e538cc23138b0a934236c5ce2b234ebc9a3349f989c6e7eaa1184a9608d5b3f77e5ff2898d2f96757d5805d39e7a1d4af349947cbef3
7
+ data.tar.gz: 7a8cec103bc680b45800f888adfda114b7cbe55d3ef5547694f2227cd79afff4f2e3b503782ae79b84f8beab7a80b6c0452369d464c8c8a9daf01e9c3c8335b3
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2
1
+ 2.4.6
data/.simplecov CHANGED
@@ -12,7 +12,7 @@ SimpleCov.start do
12
12
  # Fail the build when coverage is weak:
13
13
  at_exit do
14
14
  SimpleCov.result.format!
15
- threshold, actual = 99.75, SimpleCov.result.covered_percent
15
+ threshold, actual = 99.751, SimpleCov.result.covered_percent
16
16
  if actual < threshold
17
17
  msg = "\nLow coverage: "
18
18
  msg << red("#{actual}%")
@@ -27,5 +27,5 @@ Gem::Specification.new do |s|
27
27
  s.add_development_dependency "rake"
28
28
  s.add_development_dependency "rspec"
29
29
  s.add_development_dependency "rspec-rails"
30
- s.add_development_dependency "sqlite3"
30
+ s.add_development_dependency "sqlite3", "~> 1.3.6"
31
31
  end
@@ -24,12 +24,12 @@ module Moribus
24
24
  def association(name)
25
25
  association = super
26
26
  reflection = self.class.reflect_on_association(name)
27
- case reflection.macro
28
- when :belongs_to
29
- association.extend(HasAggregatedExtension) if reflection.options[:aggregated]
30
- when :has_one
31
- association.extend(HasCurrentExtension) if reflection.options[:is_current]
32
- else # do nothing
27
+ case reflection.try(:macro)
28
+ when :belongs_to
29
+ association.extend(HasAggregatedExtension) if reflection.options[:aggregated]
30
+ when :has_one
31
+ association.extend(HasCurrentExtension) if reflection.options[:is_current]
32
+ else # do nothing
33
33
  end
34
34
  association
35
35
  end
@@ -1,3 +1,3 @@
1
1
  module Moribus # :nodoc:
2
- VERSION = "0.5.1" # :nodoc:
2
+ VERSION = "0.6.0" # :nodoc:
3
3
  end
@@ -10,12 +10,22 @@ describe Moribus::AggregatedBehavior do
10
10
  create!(name: "jr" , description: "Junior")
11
11
  end
12
12
 
13
+ class SpecTag < MoribusSpecModel()
14
+ has_and_belongs_to_many :person_names
15
+ end
16
+
17
+ class SpecPersonNamesTags < MoribusSpecModel(spec_tag_id: :integer,
18
+ spec_person_name_id: :integer
19
+ )
20
+ end
21
+
13
22
  class SpecPersonName < MoribusSpecModel(first_name: :string,
14
23
  last_name: :string,
15
24
  spec_suffix_id: :integer
16
25
  )
17
26
  acts_as_aggregated
18
27
  has_enumerated :spec_suffix, default: ""
28
+ has_and_belongs_to_many :spec_tags
19
29
 
20
30
  validates_presence_of :first_name, :last_name
21
31
 
@@ -35,6 +45,12 @@ describe Moribus::AggregatedBehavior do
35
45
  end
36
46
 
37
47
  describe "Aggregated" do
48
+ it "supports has_and_belongs_to_many association reflections which do not have a macro" do
49
+ tags = [SpecTag.new, SpecTag.new]
50
+ name = SpecPersonName.create!(first_name: "John", last_name: "Smith", spec_tags: tags)
51
+ expect(name.spec_tags.size).to eq(2)
52
+ end
53
+
38
54
  context "definition" do
39
55
  it "raises an error on an unknown option" do
40
56
  expect{
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: HornsAndHooves-moribus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - HornsAndHooves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-11-29 00:00:00.000000000 Z
14
+ date: 2019-10-14 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -107,16 +107,16 @@ dependencies:
107
107
  name: sqlite3
108
108
  requirement: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - ">="
110
+ - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: '0'
112
+ version: 1.3.6
113
113
  type: :development
114
114
  prerelease: false
115
115
  version_requirements: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ">="
117
+ - - "~>"
118
118
  - !ruby/object:Gem::Version
119
- version: '0'
119
+ version: 1.3.6
120
120
  description: |-
121
121
  Introduces Aggregated and Tracked behavior to ActiveRecord::Base models, as well
122
122
  as Macros and Extensions modules for more efficient usage.
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
213
  version: '0'
214
214
  requirements: []
215
215
  rubyforge_project:
216
- rubygems_version: 2.7.8
216
+ rubygems_version: 2.7.9
217
217
  signing_key:
218
218
  specification_version: 4
219
219
  summary: Introduces Aggregated and Tracked behavior to ActiveRecord::Base models