active_record_survey 0.1.40 → 0.1.41
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: bb7390dcd049f2c36e3191239ddbfeb9200e63ca
|
4
|
+
data.tar.gz: 97813d862d55b74742856764b515b5ba2cd2c928
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6fb676410c50d5834894017e6084e23514f5ba6c23e8d16f8a1735880152f6c1e88af0fa3c08d3fa277b672d177758bf4bc6dfd0e4377af6f0c162f406f81a8
|
7
|
+
data.tar.gz: ae865a6cf14b316809bffc10b5a47dd2259f862be3c7cf8ce7095acfb2385fabbc848bd2fcbdda5b4b900866790db3ff9bbc15d3319fc96389ae4963ee92ea5a
|
data/.travis.yml
CHANGED
@@ -63,6 +63,7 @@ module ActiveRecordSurvey
|
|
63
63
|
to_remove.concat(node_map.self_and_descendants)
|
64
64
|
else
|
65
65
|
node_map.parent = nil
|
66
|
+
node_map.move_to_root unless node_map.new_record?
|
66
67
|
end
|
67
68
|
count = count + 1
|
68
69
|
end
|
@@ -71,6 +72,7 @@ module ActiveRecordSurvey
|
|
71
72
|
node_map.children = []
|
72
73
|
end
|
73
74
|
}
|
75
|
+
|
74
76
|
self.survey.node_maps.each { |node_map|
|
75
77
|
if to_remove.include?(node_map)
|
76
78
|
node_map.parent = nil
|
@@ -126,6 +126,28 @@ describe ActiveRecordSurvey::Node::Answer, :answer_spec => true do
|
|
126
126
|
end
|
127
127
|
|
128
128
|
describe "#build_link" do
|
129
|
+
it 'should correctly move to root when all links link removed' do
|
130
|
+
survey = ActiveRecordSurvey::Survey.new()
|
131
|
+
|
132
|
+
q1 = ActiveRecordSurvey::Node::Question.new(:text => "Question #1", :survey => survey)
|
133
|
+
q1_a1 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Q1 Answer #1")
|
134
|
+
q1_a2 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Q1 Answer #2")
|
135
|
+
q1.build_answer(q1_a1)
|
136
|
+
q1.build_answer(q1_a2)
|
137
|
+
|
138
|
+
q2 = ActiveRecordSurvey::Node::Question.new(:text => "Question #1", :survey => survey)
|
139
|
+
q2_a1 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Q1 Answer #1")
|
140
|
+
q2_a2 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Q1 Answer #2")
|
141
|
+
q2.build_answer(q2_a1)
|
142
|
+
q2.build_answer(q2_a2)
|
143
|
+
survey.save
|
144
|
+
|
145
|
+
q1_a2.build_link(q2)
|
146
|
+
|
147
|
+
q1_a2.remove_link
|
148
|
+
|
149
|
+
q2_a2.build_link(q1)
|
150
|
+
end
|
129
151
|
it 'should not have to be saved to produce a valid #as_map' do
|
130
152
|
survey = ActiveRecordSurvey::Survey.new()
|
131
153
|
q1 = ActiveRecordSurvey::Node::Question.new(:text => "Question #1", :survey => survey)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_survey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Butch Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|