poly_belongs_to 0.2.4 → 0.2.5
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 +4 -4
- data/lib/poly_belongs_to/core.rb +54 -13
- data/lib/poly_belongs_to/version.rb +1 -1
- data/test/core_test.rb +43 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +24805 -0
- data/test/dup_test.rb +3 -0
- metadata +1 -1
data/test/dup_test.rb
CHANGED
@@ -57,12 +57,14 @@ class DupTest < ActiveSupport::TestCase
|
|
57
57
|
capa = beta.capas.build; capa.save
|
58
58
|
delta = capa.deltas.build; delta.save
|
59
59
|
alpha.update(delta_id: delta.id)
|
60
|
+
|
60
61
|
it "is a circle" do
|
61
62
|
alpha.pbt_parent.must_equal delta
|
62
63
|
beta.pbt_parent.must_equal alpha
|
63
64
|
capa.pbt_parent.must_equal beta
|
64
65
|
delta.pbt_parent.must_equal capa
|
65
66
|
end
|
67
|
+
|
66
68
|
it "clones without duplicating cirular reference" do
|
67
69
|
alpha2 = Alpha.new( CleanAttrs[alpha] )
|
68
70
|
CleanAttrs[alpha2].must_equal CleanAttrs[alpha]
|
@@ -73,5 +75,6 @@ class DupTest < ActiveSupport::TestCase
|
|
73
75
|
CleanAttrs[alpha2.betas.first.capas.first.deltas.first.alphas.first].must_equal CleanAttrs[alpha]
|
74
76
|
alpha2.betas.first.capas.first.deltas.first.alphas.first.betas.first.must_be_nil
|
75
77
|
end
|
78
|
+
|
76
79
|
end
|
77
80
|
end
|