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 +4 -4
- data/.ruby-version +1 -1
- data/.simplecov +1 -1
- data/HornsAndHooves-moribus.gemspec +1 -1
- data/lib/moribus/extensions.rb +6 -6
- data/lib/moribus/version.rb +1 -1
- data/spec/moribus/aggregated_behavior_spec.rb +16 -0
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 664930f1565d0d6eaa50dc8fba6c3f90763e70c709a748f2e572f493ef2f3de5
|
4
|
+
data.tar.gz: b9541ec330424313c0e71f9605af2f2cf615d6df92b2a29961a97675cc457683
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5af699607d6d67710af3e538cc23138b0a934236c5ce2b234ebc9a3349f989c6e7eaa1184a9608d5b3f77e5ff2898d2f96757d5805d39e7a1d4af349947cbef3
|
7
|
+
data.tar.gz: 7a8cec103bc680b45800f888adfda114b7cbe55d3ef5547694f2227cd79afff4f2e3b503782ae79b84f8beab7a80b6c0452369d464c8c8a9daf01e9c3c8335b3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
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.
|
15
|
+
threshold, actual = 99.751, SimpleCov.result.covered_percent
|
16
16
|
if actual < threshold
|
17
17
|
msg = "\nLow coverage: "
|
18
18
|
msg << red("#{actual}%")
|
data/lib/moribus/extensions.rb
CHANGED
@@ -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
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
data/lib/moribus/version.rb
CHANGED
@@ -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.
|
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:
|
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:
|
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:
|
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.
|
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
|