typed_dag 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/typed_dag/edge/validations.rb +13 -2
- data/lib/typed_dag/version.rb +1 -1
- data/spec/test_app/log/test.log +0 -0
- data/spec/typed_dag/edge_spec.rb +13 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68e6894733312f8d62be51c1f249a767890402cc
|
4
|
+
data.tar.gz: b778e272530a806ec819024ce2a23597cfe1c0b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c9827091a6768cc1e449f25f5cb167bae7fc8d80039adaf7b4552e79b8c63d3a9d20db5761222efcdb0b547a72d2d77a2c505afc9d9a26f184c78702fda230c
|
7
|
+
data.tar.gz: 73c1a4980d1c5e58ab6b09470f5bdac08241e6fe6bea9f9ffb9a2ac617b28d6130845b8bede5757f7413e08148f689b308a1ec8c047fae527b746f7973b6385e
|
@@ -14,8 +14,19 @@ module TypedDag::Edge
|
|
14
14
|
private
|
15
15
|
|
16
16
|
def no_circular_dependency
|
17
|
-
|
18
|
-
|
17
|
+
# Disregard self in case one wants to inverse the edge's direction.
|
18
|
+
# If the edge has not been persisted yet, AR will turn
|
19
|
+
# where.not(id: id)
|
20
|
+
# into
|
21
|
+
# WHERE id IS NOT NULL
|
22
|
+
# which is ok.
|
23
|
+
if self
|
24
|
+
.class
|
25
|
+
.of_from_and_to(send(_dag_options.to_column),
|
26
|
+
send(_dag_options.from_column))
|
27
|
+
.where
|
28
|
+
.not(id: id)
|
29
|
+
.exists?
|
19
30
|
errors.add :base, :'typed_dag.circular_dependency'
|
20
31
|
end
|
21
32
|
end
|
data/lib/typed_dag/version.rb
CHANGED
data/spec/test_app/log/test.log
CHANGED
Binary file
|
data/spec/typed_dag/edge_spec.rb
CHANGED
@@ -134,6 +134,19 @@ RSpec.describe 'Edge' do
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
+
context 'with the relation switching directions' do
|
138
|
+
before do
|
139
|
+
relation.save
|
140
|
+
relation.from = to
|
141
|
+
relation.to = from
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'is valid' do
|
145
|
+
expect(relation)
|
146
|
+
.to be_valid
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
137
150
|
context 'with A - B - C and trying to connect C and A' do
|
138
151
|
let(:a) { Message.create text: 'A' }
|
139
152
|
let(:b) { Message.create text: 'B' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: typed_dag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- OpenProject GmbH
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|