active_record_survey 0.1.25 → 0.1.26

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,7 @@
1
1
  module FactoryGirlSurveyHelpers
2
2
  extend self
3
3
  def build_simple_survey(survey)
4
- q1 = ActiveRecordSurvey::Node::Question.new(:text => "Question #1")
5
- survey.build_question(q1)
4
+ q1 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Question #1", :survey => survey)
6
5
  q1_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 Answer #1")
7
6
  q1_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 Answer #2")
8
7
  q1_a3 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 Answer #3")
@@ -10,22 +9,19 @@ module FactoryGirlSurveyHelpers
10
9
  q1.build_answer(q1_a2)
11
10
  q1.build_answer(q1_a3)
12
11
 
13
- q2 = ActiveRecordSurvey::Node::Question.new(:text => "Question #2")
14
- survey.build_question(q2)
12
+ q2 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Question #2", :survey => survey)
15
13
  q2_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 Answer #1")
16
14
  q2_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 Answer #2")
17
15
  q2.build_answer(q2_a1)
18
16
  q2.build_answer(q2_a2)
19
17
 
20
- q3 = ActiveRecordSurvey::Node::Question.new(:text => "Question #3")
21
- survey.build_question(q3)
18
+ q3 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Question #3", :survey => survey)
22
19
  q3_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 Answer #1")
23
20
  q3_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 Answer #2")
24
21
  q3.build_answer(q3_a1)
25
22
  q3.build_answer(q3_a2)
26
23
 
27
- q4 = ActiveRecordSurvey::Node::Question.new(:text => "Question #4")
28
- survey.build_question(q4)
24
+ q4 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Question #4", :survey => survey)
29
25
  q4_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 Answer #1")
30
26
  q4_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 Answer #2")
31
27
  q4.build_answer(q4_a1)
@@ -45,8 +41,7 @@ module FactoryGirlSurveyHelpers
45
41
  q3_a2.build_link(q4)
46
42
  end
47
43
  def build_basic_survey(survey)
48
- q1 = ActiveRecordSurvey::Node::Question.new(:text => "Q1")
49
- survey.build_question(q1)
44
+ q1 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q1", :survey => survey)
50
45
  q1_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A1")
51
46
  q1_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A2")
52
47
  q1_a3 = ActiveRecordSurvey::Node::Answer.new(:text => "Q1 A3")
@@ -54,36 +49,31 @@ module FactoryGirlSurveyHelpers
54
49
  q1.build_answer(q1_a2)
55
50
  q1.build_answer(q1_a3)
56
51
 
57
- q2 = ActiveRecordSurvey::Node::Question.new(:text => "Q2")
58
- survey.build_question(q2)
52
+ q2 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q2", :survey => survey)
59
53
  q2_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 A1")
60
54
  q2_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q2 A2")
61
55
  q2.build_answer(q2_a1)
62
56
  q2.build_answer(q2_a2)
63
57
 
64
- q3 = ActiveRecordSurvey::Node::Question.new(:text => "Q3")
65
- survey.build_question(q3)
58
+ q3 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q3", :survey => survey)
66
59
  q3_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 A1")
67
60
  q3_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q3 A2")
68
61
  q3.build_answer(q3_a1)
69
62
  q3.build_answer(q3_a2)
70
63
 
71
- q4 = ActiveRecordSurvey::Node::Question.new(:text => "Q4")
72
- survey.build_question(q4)
64
+ q4 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q4", :survey => survey)
73
65
  q4_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 A1")
74
66
  q4_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q4 A2")
75
67
  q4.build_answer(q4_a1)
76
68
  q4.build_answer(q4_a2)
77
69
 
78
- q5 = ActiveRecordSurvey::Node::Question.new(:text => "Q5 Boolean")
79
- survey.build_question(q5)
70
+ q5 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q5 Boolean", :survey => survey)
80
71
  q5_a1 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Q5 A1")
81
72
  q5_a2 = ActiveRecordSurvey::Node::Answer::Boolean.new(:text => "Q5 A2")
82
73
  q5.build_answer(q5_a1)
83
74
  q5.build_answer(q5_a2)
84
75
 
85
- q6 = ActiveRecordSurvey::Node::Question.new(:text => "Q6")
86
- survey.build_question(q6)
76
+ q6 = survey.questions.build(:type => "ActiveRecordSurvey::Node::Question", :text => "Q6", :survey => survey)
87
77
  q6_a1 = ActiveRecordSurvey::Node::Answer.new(:text => "Q6 A1")
88
78
  q6_a2 = ActiveRecordSurvey::Node::Answer.new(:text => "Q6 A2")
89
79
  q6.build_answer(q6_a1)
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,8 @@ require 'database_cleaner'
11
11
  # Trigger AR to initialize
12
12
  ActiveRecord::Base
13
13
 
14
+ #ActiveRecord::Base.logger = Logger.new(STDOUT)
15
+
14
16
  module Rails
15
17
  def self.root
16
18
  '.'
@@ -30,9 +32,11 @@ end
30
32
  ActiveRecord::Migration.verbose = false
31
33
 
32
34
  require "generators/active_record_survey/templates/migration_0.1.0"
35
+ require "generators/active_record_survey/templates/migration_0.1.26"
33
36
 
34
37
  ActiveRecord::Schema.define do
35
38
  AddActiveRecordSurvey.up
39
+ Update_0_1_26_ActiveRecordSurvey.up
36
40
 
37
41
  # Make it easier when you can put text on things
38
42
  add_column :active_record_survey_nodes, :text, :string
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.25
4
+ version: 0.1.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Butch Marshall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-13 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '2.0'
39
+ version: '3.0'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: '2.0'
46
+ version: '3.0'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sqlite3
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +165,7 @@ files:
165
165
  - lib/generators/active_record_survey/active_record_survey_generator.rb
166
166
  - lib/generators/active_record_survey/next_migration_version.rb
167
167
  - lib/generators/active_record_survey/templates/migration_0.1.0.rb
168
+ - lib/generators/active_record_survey/templates/migration_0.1.26.rb
168
169
  - rspec_rvm
169
170
  - spec/active_record_survey/node/answer/boolean_spec.rb
170
171
  - spec/active_record_survey/node/answer/rank_spec.rb