unidom-standard 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337e62c070e6119891f65796769c5a3a220bfc8f
|
4
|
+
data.tar.gz: 50f8291641b9353702b0b553fcf263070a60f342
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8090e10fd94919eae6a69024f7e29f0c07f07a8c61abefc9e3a05a5d41c64c87ce9e2e345485709d7a69cc0cbbe427ce9aeef4f9b4ba282b255e2ce0d3d4547
|
7
|
+
data.tar.gz: 16d6e18fb1918ab74626c6be6e67fab1c0ec41757390c652787c207f0614c7a5625fde025efaf790690c0e98cbc72246d7dc9992f10929c057362b894ac1c3c7
|
@@ -11,8 +11,8 @@ class Unidom::Standard::StandardAssociating < Unidom::Standard::ApplicationRecor
|
|
11
11
|
belongs_to :source, class_name: 'Unidom::Standard::Standard', foreign_key: :source_id
|
12
12
|
belongs_to :target, class_name: 'Unidom::Standard::Standard', foreign_key: :target_id
|
13
13
|
|
14
|
-
scope :source_is, ->(source) { where
|
15
|
-
scope :target_is, ->(target) { where
|
14
|
+
scope :source_is, ->(source) { where source: source }
|
15
|
+
scope :target_is, ->(target) { where target: target }
|
16
16
|
|
17
17
|
def self.associate!(source, with: target, due_to: 'REVS', at: Time.now)
|
18
18
|
create! source_id: to_id(source), target_id: to_id(with), association_code: due_to, opened_at: at
|
@@ -16,17 +16,29 @@ describe Unidom::Standard::StandardAssociating, type: :model do
|
|
16
16
|
|
17
17
|
it_behaves_like 'Unidom::Common::Concerns::ModelExtension', model_attributes
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
19
|
+
source_standard_attributes = {
|
20
|
+
name: 'Source Name',
|
21
|
+
number: 'GB/T 3259-2008',
|
22
|
+
ics_code: '11-23-68',
|
23
|
+
published_on: Date.current-20.years,
|
24
|
+
applied_on: Date.current,
|
25
|
+
obsoleted_on: Date.current+1.year
|
26
|
+
}
|
27
|
+
|
28
|
+
target_standard_attributes = {
|
29
|
+
name: 'Target Name',
|
30
|
+
number: 'GB/T 3259-2018',
|
31
|
+
ics_code: '11-23-68',
|
32
|
+
published_on: Date.current+1.year,
|
33
|
+
applied_on: Date.current,
|
34
|
+
obsoleted_on: Date.current+20.years
|
35
|
+
}
|
36
|
+
|
37
|
+
it_behaves_like 'belongs_to', model_attributes, :source, Unidom::Standard::Standard, source_standard_attributes
|
38
|
+
it_behaves_like 'belongs_to', model_attributes, :target, Unidom::Standard::Standard, target_standard_attributes
|
39
|
+
|
40
|
+
it_behaves_like 'monomorphic scope', model_attributes, :source_is, :source
|
41
|
+
it_behaves_like 'monomorphic scope', model_attributes, :target_is, :target
|
30
42
|
|
31
43
|
end
|
32
44
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unidom-standard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Topbit Du
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: unidom-common
|