active_record_survey 0.1.40 → 0.1.41

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ec49942bdb8de3f5ea1c79c524a7756c0c23ca5
4
- data.tar.gz: 4a951bb87e0f5b9990eb1b6648fe41652a18426e
3
+ metadata.gz: bb7390dcd049f2c36e3191239ddbfeb9200e63ca
4
+ data.tar.gz: 97813d862d55b74742856764b515b5ba2cd2c928
5
5
  SHA512:
6
- metadata.gz: 4095f4b2118338abeed4e6a9c69f134479491ff45af9b997a8389b7f6562df34318c0b0ce842217599c1b43128e108c083ca57421de52723e5d4fe360554bba1
7
- data.tar.gz: 57dcd1b8f5c50ccfcb43d551fb6d6ae0414f6f39cfd1527418dfe761ddc4ba50721c26e0ff257ff83bc1744c2d4e20ce8e881a9f0358ab95315a2579838c0edf
6
+ metadata.gz: f6fb676410c50d5834894017e6084e23514f5ba6c23e8d16f8a1735880152f6c1e88af0fa3c08d3fa277b672d177758bf4bc6dfd0e4377af6f0c162f406f81a8
7
+ data.tar.gz: ae865a6cf14b316809bffc10b5a47dd2259f862be3c7cf8ce7095acfb2385fabbc848bd2fcbdda5b4b900866790db3ff9bbc15d3319fc96389ae4963ee92ea5a
data/.travis.yml CHANGED
@@ -2,5 +2,4 @@ language: ruby
2
2
  rvm:
3
3
  - 2.1.1
4
4
  - 2.0.0
5
- - 1.9.3
6
5
  script: rspec spec
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordSurvey
2
- VERSION = "0.1.40"
2
+ VERSION = "0.1.41"
3
3
  end
@@ -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.40
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-08-28 00:00:00.000000000 Z
11
+ date: 2016-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord