active_record_survey 0.1.27 → 0.1.28
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/active_record_survey/version.rb +1 -1
- data/spec/active_record_survey/node_map_spec.rb +60 -0
- metadata +5 -7
- data/bin/console +0 -14
- data/bin/setup +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28cbe125545e5fec174484486e07e7ac56088438
|
4
|
+
data.tar.gz: 39c903c6db06d0f0c8b89a5aa18e766e776167eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 863edda965f97873d7e7e3e4a0376b31b4df9f4e683f8fec0cc3fadc6a50e3571d421a2b2c5c82054d9bf27ad3545fec044057059244833f93deb93bd3038dd7
|
7
|
+
data.tar.gz: fdcbe0660f224af0d1b551724afe93e16f2876007f1aa23bb2c8f8295d79c44121127af31e27ee7d17c2de35828209b2d3d6e5e5302ff7ab1ba375a73ecad50b
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveRecordSurvey::NodeMap, :node_map_spec => true do
|
4
|
+
describe '#has_infinite_loop?' do
|
5
|
+
before(:each) do
|
6
|
+
@survey = ActiveRecordSurvey::Survey.create()
|
7
|
+
@q1 = @survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q1", :survey => @survey)
|
8
|
+
@q1_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A1")
|
9
|
+
@q1_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A2")
|
10
|
+
@q1_a3 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A3")
|
11
|
+
@q1_a4 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A4")
|
12
|
+
@q1.build_answer(@q1_a1)
|
13
|
+
@q1.build_answer(@q1_a2)
|
14
|
+
@q1.build_answer(@q1_a3)
|
15
|
+
@q1.build_answer(@q1_a4)
|
16
|
+
|
17
|
+
@q2 = @survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q2", :survey => @survey)
|
18
|
+
@q2_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 A1")
|
19
|
+
@q2_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 A2")
|
20
|
+
@q2.build_answer(@q2_a1)
|
21
|
+
@q2.build_answer(@q2_a2)
|
22
|
+
|
23
|
+
@q3 = @survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q3", :survey => @survey)
|
24
|
+
@q3_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 A1")
|
25
|
+
@q3_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 A2")
|
26
|
+
@q3.build_answer(@q3_a1)
|
27
|
+
@q3.build_answer(@q3_a2)
|
28
|
+
|
29
|
+
@q4 = @survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q4", :survey => @survey)
|
30
|
+
@q4_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 A1")
|
31
|
+
@q4_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 A2")
|
32
|
+
@q4.build_answer(@q4_a1)
|
33
|
+
@q4.build_answer(@q4_a2)
|
34
|
+
|
35
|
+
@q1_a1.build_link(@q3)
|
36
|
+
@q1_a2.build_link(@q4)
|
37
|
+
@q1_a3.build_link(@q3)
|
38
|
+
@q1_a4.build_link(@q3)
|
39
|
+
|
40
|
+
@q2_a1.build_link(@q1)
|
41
|
+
@q2_a2.build_link(@q4)
|
42
|
+
|
43
|
+
@q3_a1.build_link(@q4)
|
44
|
+
@q3_a2.build_link(@q4)
|
45
|
+
end
|
46
|
+
|
47
|
+
describe 'build' do
|
48
|
+
it 'should not allow finite loop' do
|
49
|
+
expect { @q4_a1.build_link(@q1) }.to raise_error RuntimeError
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'save' do
|
54
|
+
it 'should not allow finite loop' do
|
55
|
+
@survey.save
|
56
|
+
expect { @q4_a1.build_link(@q1) }.to raise_error RuntimeError
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
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.28
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Butch Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -121,8 +121,6 @@ executables:
|
|
121
121
|
- Example_1.png
|
122
122
|
- Example_1.svg
|
123
123
|
- Example_1.xml
|
124
|
-
- console
|
125
|
-
- setup
|
126
124
|
extensions: []
|
127
125
|
extra_rdoc_files: []
|
128
126
|
files:
|
@@ -137,8 +135,6 @@ files:
|
|
137
135
|
- bin/Example_1.png
|
138
136
|
- bin/Example_1.svg
|
139
137
|
- bin/Example_1.xml
|
140
|
-
- bin/console
|
141
|
-
- bin/setup
|
142
138
|
- lib/active_record_survey.rb
|
143
139
|
- lib/active_record_survey/compatibility.rb
|
144
140
|
- lib/active_record_survey/instance.rb
|
@@ -173,6 +169,7 @@ files:
|
|
173
169
|
- spec/active_record_survey/node/answer/text_spec.rb
|
174
170
|
- spec/active_record_survey/node/answer_spec.rb
|
175
171
|
- spec/active_record_survey/node/question_spec.rb
|
172
|
+
- spec/active_record_survey/node_map_spec.rb
|
176
173
|
- spec/active_record_survey/survey_spec.rb
|
177
174
|
- spec/active_record_survey_spec.rb
|
178
175
|
- spec/factories/active_record_survey/survey.rb
|
@@ -197,7 +194,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
194
|
version: '0'
|
198
195
|
requirements: []
|
199
196
|
rubyforge_project:
|
200
|
-
rubygems_version: 2.
|
197
|
+
rubygems_version: 2.6.2
|
201
198
|
signing_key:
|
202
199
|
specification_version: 4
|
203
200
|
summary: Surveys using activerecord
|
@@ -208,6 +205,7 @@ test_files:
|
|
208
205
|
- spec/active_record_survey/node/answer/text_spec.rb
|
209
206
|
- spec/active_record_survey/node/answer_spec.rb
|
210
207
|
- spec/active_record_survey/node/question_spec.rb
|
208
|
+
- spec/active_record_survey/node_map_spec.rb
|
211
209
|
- spec/active_record_survey/survey_spec.rb
|
212
210
|
- spec/active_record_survey_spec.rb
|
213
211
|
- spec/factories/active_record_survey/survey.rb
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "active_record_survey"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|