rapidfire 5.0.0 → 8.0.0

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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/models/rapidfire/question.rb +1 -1
  4. data/app/models/rapidfire/survey.rb +1 -1
  5. data/app/services/rapidfire/attempt_builder.rb +2 -1
  6. data/app/views/rapidfire/attempts/_form.html.erb +8 -0
  7. data/lib/rapidfire/version.rb +1 -1
  8. data/spec/controllers/rapidfire/attempts_controller_spec.rb +1 -1
  9. data/spec/dummy/config/environments/development.rb +1 -1
  10. data/spec/dummy/db/development.sqlite3 +0 -0
  11. data/spec/dummy/db/schema.rb +1 -3
  12. data/spec/dummy/db/test.sqlite3 +0 -0
  13. data/spec/dummy/log/development.log +90 -0
  14. data/spec/dummy/log/test.log +7067 -70435
  15. data/spec/factories/answers_factory.rb +4 -4
  16. data/spec/factories/attempts_factory.rb +2 -2
  17. data/spec/factories/questions_factory.rb +7 -7
  18. data/spec/factories/surveys_factory.rb +3 -3
  19. data/spec/factories/users_factory.rb +2 -2
  20. data/spec/features/rapidfire/answering_questions_spec.rb +25 -8
  21. data/spec/features/rapidfire/editing_answers_spec.rb +6 -6
  22. data/spec/features/rapidfire/managing_questions_spec.rb +3 -3
  23. data/spec/features/rapidfire/managing_surveys_spec.rb +18 -3
  24. data/spec/models/rapidfire/answer_spec.rb +2 -2
  25. data/spec/models/rapidfire/question_spec.rb +3 -3
  26. data/spec/models/rapidfire/questions/checkbox_spec.rb +3 -3
  27. data/spec/models/rapidfire/questions/date_spec.rb +2 -2
  28. data/spec/models/rapidfire/questions/file_spec.rb +2 -2
  29. data/spec/models/rapidfire/questions/multi_file_spec.rb +2 -2
  30. data/spec/models/rapidfire/questions/numeric_spec.rb +2 -2
  31. data/spec/models/rapidfire/questions/select_spec.rb +3 -3
  32. data/spec/models/rapidfire/survey_spec.rb +1 -1
  33. data/spec/serializers/rapidfire/question_result_serializer_spec.rb +1 -1
  34. data/spec/services/rapidfire/attempt_builder_spec.rb +5 -5
  35. data/spec/services/rapidfire/question_form_spec.rb +3 -3
  36. data/spec/services/rapidfire/survey_results_spec.rb +1 -1
  37. data/spec/spec_helper.rb +1 -1
  38. data/spec/support/rapidfire/answer_spec_helper.rb +12 -12
  39. data/spec/support/rapidfire/question_spec_helper.rb +7 -7
  40. data/spec/tasks/change_delimiter_from_comma_to_srsn_spec.rb +8 -8
  41. metadata +39 -125
  42. data/spec/dummy/tmp/capybara/capybara-202304042341376066162578.html +0 -29
  43. data/spec/dummy/tmp/capybara/capybara-202304042343302647462912.html +0 -29
  44. data/spec/dummy/tmp/capybara/capybara-202304042343539524195351.html +0 -29
  45. data/spec/dummy/tmp/capybara/capybara-202304042344039569698410.html +0 -29
  46. data/spec/dummy/tmp/capybara/capybara-202304042344107081227684.html +0 -29
  47. data/spec/dummy/tmp/capybara/capybara-202304042346131668826835.html +0 -29
  48. data/spec/dummy/tmp/capybara/capybara-202304042346251478672095.html +0 -29
  49. data/spec/dummy/tmp/capybara/capybara-202304042346382011987550.html +0 -29
  50. data/spec/dummy/tmp/capybara/capybara-20230404234755589239852.html +0 -29
  51. data/spec/dummy/tmp/capybara/capybara-202304042348377947112508.html +0 -29
  52. data/spec/dummy/tmp/capybara/capybara-202304042348502970551073.html +0 -55
  53. data/spec/dummy/tmp/capybara/capybara-202304042351403473706214.html +0 -29
  54. data/spec/dummy/tmp/capybara/capybara-202304042352069122239363.html +0 -29
  55. data/spec/dummy/tmp/capybara/capybara-202304042353148433036065.html +0 -29
  56. data/spec/dummy/tmp/capybara/capybara-202304042353383278368450.html +0 -29
  57. data/spec/dummy/tmp/capybara/capybara-202304042358431743077504.html +0 -20
  58. data/spec/dummy/tmp/capybara/capybara-202304042358433434523512.html +0 -20
  59. data/spec/dummy/tmp/capybara/capybara-202304042358434379121493.html +0 -20
  60. data/spec/dummy/tmp/capybara/capybara-202304042358492996621343.html +0 -20
  61. data/spec/dummy/tmp/storage/2e/vk/2evksypp3ct4p9cjihfxwomru17i +0 -1
  62. data/spec/dummy/tmp/storage/9k/xt/9kxth5brdkw4huy7lciesekum0pt +0 -1
  63. data/spec/dummy/tmp/storage/cu/44/cu4452jrce4gd0ebcqop1d22kwbs +0 -1
  64. data/spec/dummy/tmp/storage/dl/oy/dloy0dbuquwe0f48bhugjca71pbv +0 -1
  65. data/spec/dummy/tmp/storage/h5/vc/h5vcb12f2cviqinrckfmmz4wtsa7 +0 -1
  66. data/spec/dummy/tmp/storage/ht/4x/ht4xma120asy3gd0fpeseddjzb2l +0 -1
  67. data/spec/dummy/tmp/storage/ip/au/ipauutuc5vy678hrwz4jx3rvm0n6 +0 -1
  68. data/spec/dummy/tmp/storage/j1/uy/j1uyrkrosby81sgq1mf59bs7oqee +0 -1
  69. data/spec/dummy/tmp/storage/nj/vv/njvvpx93zptrmlwbwiuxmxyh1jnf +0 -1
  70. data/spec/dummy/tmp/storage/nv/nx/nvnxlyvw3vd8xsq2sa4eazqepgbn +0 -1
  71. data/spec/dummy/tmp/storage/of/b4/ofb41sjj1mp33qs3wsivadhuts3p +0 -1
  72. data/spec/dummy/tmp/storage/og/ee/ogeerywp2y4szmnlrc5fnuya2evl +0 -1
  73. data/spec/dummy/tmp/storage/wz/oc/wzocvk4ahpp7kwc951u7f78nj259 +0 -1
  74. data/spec/dummy/tmp/storage/z3/vx/z3vxuitmnxld08m0qvt9057uyglc +0 -1
  75. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/k8/br/k8br0vtpgmpqxrl8mdsceymh3c8d +0 -1
  76. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/mw/le/mwle6olsgsk8h2pxvklj5q0yr9sc +0 -1
  77. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/o1/2w/o12whqlkt6rc0yaq3b6fsowmewdp +0 -1
  78. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/o9/2g/o92go6wavds5oht0dso6m1ybvbh4 +0 -1
  79. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/om/7f/om7frlle7xz8pybxbydeq1q20hro +0 -1
  80. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/q6/78/q678f1u8v1nv07dbtm85knmw3b9q +0 -1
  81. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/r4/wp/r4wpzje2mix0dtl8r2f4akh18fm1 +0 -1
  82. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/v1/h9/v1h9cuuwtwvz8p6fl574qum6k4ig +0 -1
  83. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/vb/mw/vbmwrl014lccj3jo61vojqscfxha +0 -1
  84. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/wn/q4/wnq49hhhxvh4gnc2782lf4zzlz46 +0 -1
  85. data/spec/dummy/tmp/storage-7.0.0-ruby-3.2.0/ya/go/yago1kn4o7p8jfob0cxetrif714s +0 -1
  86. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/40/x5/40x5xe5nmit9ngld2lngzfjp6r6x → storage--ruby-3.3.5/81/2n/812ne4iy4c40lvvdigsg8z02b1v1} +0 -0
  87. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/7h/za/7hza4otjknyyo14szs2az8wiu7ai → storage--ruby-3.3.5/85/bs/85bsmaecej0491dey4t9jpci9yw3} +0 -0
  88. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/1b/cx/1bcxhbuf0bwp8uduq76gye1v11al → storage--ruby-3.3.5/8y/7b/8y7bhqwxh5cad8xau7nfhtukxcsc} +0 -0
  89. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/ad/ct/adct5ysy5mq6kyptqk5q3fzfpwui → storage--ruby-3.3.5/93/z6/93z6nje4f921vgdwa3lkuf49xocr} +0 -0
  90. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/bl/yo/blyo13wkf0l9igpyq4anaqbomz0h → storage--ruby-3.3.5/at/qk/atqksrev4s0ic4srii57aspu4o6z} +0 -0
  91. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/cc/g8/ccg8282dt6ixi4yvvwjt4noqa6pj → storage--ruby-3.3.5/bi/j3/bij3puzjsfm39colnpqstpu6ggv7} +0 -0
  92. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/d3/gj/d3gjt0qoinigrbao1anp4hmvedjm → storage--ruby-3.3.5/cx/4p/cx4pp9ugdv2xndwll28mo8jhjgig} +0 -0
  93. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/n7/ja/n7jacvu07s9z9ai7acjq8kovdh02 → storage--ruby-3.3.5/gv/9c/gv9cand9rqcew9sceoirbfm9l2bl} +0 -0
  94. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/f2/bv/f2bvz6ws3xfrk17dpzhyacx3kys2 → storage--ruby-3.3.5/m2/ce/m2cehdwpmdl0s5vgylxc1tcbxlr2} +0 -0
  95. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/f8/3z/f83z2f041tfpu39ygi0gu32wai8x → storage--ruby-3.3.5/md/rj/mdrjgxirkdtyfijfwdxn37dswspm} +0 -0
  96. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/gt/rc/gtrco13ij0i2vi27t6wm1jhcve5p → storage--ruby-3.3.5/xv/oi/xvoijswvk9a0blrua7x5yl94a6qw} +0 -0
  97. /data/spec/dummy/tmp/{storage-7.0.0-ruby-3.2.0/qq/kc/qqkciwi2vymum1556755n85po1j9 → storage--ruby-3.3.5/z6/cw/z6cw41euxe15z3ao5wkypp0y9liw} +0 -0
@@ -1,7 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :answer, :class => "Rapidfire::Answer" do
3
- attempt { FactoryGirl.create(:attempt) }
4
- question { FactoryGirl.create(:q_long) }
5
- answer_text "hello world"
3
+ attempt { FactoryBot.create(:attempt) }
4
+ question { FactoryBot.create(:q_long) }
5
+ answer_text { "hello world" }
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :attempt, :class => "Rapidfire::Attempt" do
3
- survey { FactoryGirl.create(:survey) }
3
+ survey { FactoryBot.create(:survey) }
4
4
  end
5
5
  end
@@ -1,10 +1,10 @@
1
- FactoryGirl.define do
2
- factory :question do
3
- survey { FactoryGirl.create(:survey) }
4
- question_text "Sample Question"
1
+ FactoryBot.define do
2
+ factory :question, :class => "Rapidfire::Question" do
3
+ survey { FactoryBot.create(:survey) }
4
+ question_text { "Sample Question" }
5
5
 
6
6
  factory :q_checkbox, :class => "Rapidfire::Questions::Checkbox" do
7
- answer_options "hindi\r\ntelugu\r\nkannada\r\n"
7
+ answer_options { "hindi\r\ntelugu\r\nkannada\r\n" }
8
8
  end
9
9
 
10
10
  factory :q_date, :class => "Rapidfire::Questions::Date" do
@@ -17,11 +17,11 @@ FactoryGirl.define do
17
17
  end
18
18
 
19
19
  factory :q_radio, :class => "Rapidfire::Questions::Radio" do
20
- answer_options "male\r\nfemale\r\n"
20
+ answer_options { "male\r\nfemale\r\n" }
21
21
  end
22
22
 
23
23
  factory :q_select, :class => "Rapidfire::Questions::Select" do
24
- answer_options "mac\r\nwindows\r\n"
24
+ answer_options { "mac\r\nwindows\r\n" }
25
25
  end
26
26
 
27
27
  factory :q_short, :class => "Rapidfire::Questions::Short" do
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :survey, :class => "Rapidfire::Survey" do
3
- name "Test Survey"
4
- introduction "Please answer all the questions in this survey."
3
+ name { "Test Survey" }
4
+ introduction { "Please answer all the questions in this survey." }
5
5
  end
6
6
  end
@@ -1,5 +1,5 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :user do
3
- name "Test User"
3
+ name { "Test User" }
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Surveys" do
4
- let!(:survey) { FactoryGirl.create(:survey, name: "Question Set", introduction: "Some introduction") }
4
+ let!(:survey) { FactoryBot.create(:survey, name: "Question Set", introduction: "Some introduction") }
5
5
 
6
6
  it "displays survey introduction" do
7
7
  visit rapidfire.new_survey_attempt_path(survey)
@@ -10,10 +10,10 @@ describe "Surveys" do
10
10
  end
11
11
 
12
12
  describe "Answering Questions" do
13
- let!(:question1) { FactoryGirl.create(:q_long, survey: survey, question_text: "Long Question", validation_rules: { presence: "1" }) }
14
- let!(:question2) { FactoryGirl.create(:q_short, survey: survey, question_text: "Short Question") }
15
- let!(:question3) { FactoryGirl.create(:q_checkbox, survey: survey, question_text: "Checkbox question") }
16
- let!(:question4) { FactoryGirl.create(:q_checkbox, survey: survey, question_text: "Checkbox question", validation_rules: { presence: "1" }) }
13
+ let!(:question1) { FactoryBot.create(:q_long, survey: survey, question_text: "Long Question", validation_rules: { presence: "1" }) }
14
+ let!(:question2) { FactoryBot.create(:q_short, survey: survey, question_text: "Short Question") }
15
+ let!(:question3) { FactoryBot.create(:q_checkbox, survey: survey, question_text: "Checkbox question") }
16
+ let!(:question4) { FactoryBot.create(:q_checkbox, survey: survey, question_text: "Checkbox question", validation_rules: { presence: "1" }) }
17
17
 
18
18
  before do
19
19
  visit rapidfire.new_survey_attempt_path(survey)
@@ -56,7 +56,7 @@ describe "Surveys" do
56
56
  end
57
57
 
58
58
  it "shows error for missing answers" do
59
- expect(page).to have_content("can't be blank", count: 2)
59
+ expect(page).to have_content("can't be blank", count: 3)
60
60
  end
61
61
 
62
62
  it "shows already populated answers" do
@@ -92,7 +92,7 @@ describe "Surveys" do
92
92
  if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" >= "5.2"
93
93
  describe "Answering File uploads" do
94
94
  context "when the question is single file upload" do
95
- let!(:question1) { FactoryGirl.create(:q_file, survey: survey, question_text: "Avatar") }
95
+ let!(:question1) { FactoryBot.create(:q_file, survey: survey, question_text: "Avatar") }
96
96
 
97
97
  it "persistes the file" do
98
98
  visit rapidfire.new_survey_attempt_path(survey)
@@ -107,7 +107,7 @@ describe "Surveys" do
107
107
  end
108
108
 
109
109
  context "when the question is multi file upload" do
110
- let!(:question1) { FactoryGirl.create(:q_multifile, survey: survey, question_text: "Images") }
110
+ let!(:question1) { FactoryBot.create(:q_multifile, survey: survey, question_text: "Images") }
111
111
 
112
112
  it "persistes the file" do
113
113
  visit rapidfire.new_survey_attempt_path(survey)
@@ -123,6 +123,23 @@ describe "Surveys" do
123
123
  expect(answer.files[1].download).to eq("one\n")
124
124
  end
125
125
  end
126
+
127
+ context "when persisting a file fails" do
128
+ let!(:question1) { FactoryBot.create(:q_file, survey: survey, question_text: "Avatar") }
129
+
130
+ it "bubbles up the error" do
131
+ visit rapidfire.new_survey_attempt_path(survey)
132
+
133
+ expect_any_instance_of(Rapidfire::Answer).to receive("file_attachment=") do
134
+ raise ActiveRecord::ActiveRecordError.new("Can't save the file")
135
+ end
136
+
137
+ attach_file "attempt_#{question1.id}_file", file_fixture("one.txt")
138
+ click_button "Save"
139
+
140
+ expect(page).to have_content("Can't save the file")
141
+ end
142
+ end
126
143
  end
127
144
  end
128
145
  end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Surveys" do
4
- let(:survey) { FactoryGirl.create(:survey, name: "Question Set") }
5
- let(:question1) { FactoryGirl.create(:q_long, survey: survey, question_text: "Long Question", validation_rules: { presence: "1" }) }
6
- let(:question2) { FactoryGirl.create(:q_short, survey: survey, question_text: "Short Question") }
7
- let(:attempt) { FactoryGirl.create(:attempt, survey: survey) }
8
- let!(:answer1) { FactoryGirl.create(:answer, attempt: attempt, question: question1, answer_text: "Long Answer") }
9
- let!(:answer2) { FactoryGirl.create(:answer, attempt: attempt, question: question2, answer_text: "Short Answer") }
4
+ let(:survey) { FactoryBot.create(:survey, name: "Question Set") }
5
+ let(:question1) { FactoryBot.create(:q_long, survey: survey, question_text: "Long Question", validation_rules: { presence: "1" }) }
6
+ let(:question2) { FactoryBot.create(:q_short, survey: survey, question_text: "Short Question") }
7
+ let(:attempt) { FactoryBot.create(:attempt, survey: survey) }
8
+ let!(:answer1) { FactoryBot.create(:answer, attempt: attempt, question: question1, answer_text: "Long Answer") }
9
+ let!(:answer2) { FactoryBot.create(:answer, attempt: attempt, question: question2, answer_text: "Short Answer") }
10
10
  before do
11
11
  visit rapidfire.edit_survey_attempt_path(survey, attempt)
12
12
  end
@@ -1,9 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe "Questions" do
4
- let(:survey) { FactoryGirl.create(:survey, name: "Question Set") }
5
- let(:question1) { FactoryGirl.create(:q_long, survey: survey, question_text: "Long Question") }
6
- let(:question2) { FactoryGirl.create(:q_short, survey: survey, question_text: "Short Question") }
4
+ let(:survey) { FactoryBot.create(:survey, name: "Question Set") }
5
+ let(:question1) { FactoryBot.create(:q_long, survey: survey, question_text: "Long Question") }
6
+ let(:question2) { FactoryBot.create(:q_short, survey: survey, question_text: "Short Question") }
7
7
  before do
8
8
  [question1, question2]
9
9
  end
@@ -4,9 +4,9 @@ describe "Surveys" do
4
4
  include Rapidfire::QuestionSpecHelper
5
5
  include Rapidfire::AnswerSpecHelper
6
6
 
7
- let(:survey) { FactoryGirl.create(:survey, name: "Question Set") }
8
- let(:question1) { FactoryGirl.create(:q_long, survey: survey, question_text: "Long Question") }
9
- let(:question2) { FactoryGirl.create(:q_short, survey: survey, question_text: "Short Question") }
7
+ let(:survey) { FactoryBot.create(:survey, name: "Question Set") }
8
+ let(:question1) { FactoryBot.create(:q_long, survey: survey, question_text: "Long Question") }
9
+ let(:question2) { FactoryBot.create(:q_short, survey: survey, question_text: "Short Question") }
10
10
  before do
11
11
  [question1, question2]
12
12
  end
@@ -94,6 +94,21 @@ describe "Surveys" do
94
94
  expect(page).not_to have_link "New Survey"
95
95
  end
96
96
  end
97
+
98
+ context "when creating a survey fails" do
99
+ before do
100
+ allow_any_instance_of(ApplicationController).to receive(:can_administer?).and_return(true)
101
+ end
102
+
103
+ it "throws an error message" do
104
+ visit rapidfire.root_path
105
+ click_link "New Survey"
106
+
107
+ click_button "Create Survey"
108
+
109
+ expect(page).to have_content "Name can't be blank"
110
+ end
111
+ end
97
112
  end
98
113
 
99
114
  describe "EDITING Surveys" do
@@ -2,12 +2,12 @@ require 'spec_helper'
2
2
 
3
3
  describe Rapidfire::Answer do
4
4
  describe "Validations" do
5
- subject { FactoryGirl.build(:answer) }
5
+ subject { FactoryBot.build(:answer) }
6
6
  it { is_expected.to validate_presence_of(:question) }
7
7
  it { is_expected.to validate_presence_of(:attempt) }
8
8
 
9
9
  context "when validations are run" do
10
- let(:answer) { FactoryGirl.build(:answer) }
10
+ let(:answer) { FactoryBot.build(:answer) }
11
11
 
12
12
  it "delegates validation of answer text to question" do
13
13
  expect(answer.question).to receive(:validate_answer).with(answer).once
@@ -11,7 +11,7 @@ describe Rapidfire::Question do
11
11
  end
12
12
 
13
13
  describe "#rules" do
14
- let(:question) { FactoryGirl.create(:q_long, validation_rules: validation_rules) }
14
+ let(:question) { FactoryBot.create(:q_long, validation_rules: validation_rules) }
15
15
 
16
16
  context "when there are no validation rules" do
17
17
  let(:validation_rules) { {} }
@@ -33,8 +33,8 @@ describe Rapidfire::Question do
33
33
  end
34
34
 
35
35
  describe "validate_answer" do
36
- let(:question) { FactoryGirl.create(:q_long, validation_rules: validation_rules) }
37
- let(:answer) { FactoryGirl.build(:answer, question: question, answer_text: answer_text) }
36
+ let(:question) { FactoryBot.create(:q_long, validation_rules: validation_rules) }
37
+ let(:answer) { FactoryBot.build(:answer, question: question, answer_text: answer_text) }
38
38
  before { answer.valid? }
39
39
 
40
40
  context "when there are no validation rules" do
@@ -6,7 +6,7 @@ describe Rapidfire::Questions::Checkbox do
6
6
  end
7
7
 
8
8
  describe "#options" do
9
- let(:question) { FactoryGirl.create(:q_select) }
9
+ let(:question) { FactoryBot.create(:q_select) }
10
10
 
11
11
  it "returns options" do
12
12
  expect(question.options).to match_array(["mac", "windows"])
@@ -14,8 +14,8 @@ describe Rapidfire::Questions::Checkbox do
14
14
  end
15
15
 
16
16
  describe "validate_answer" do
17
- let(:question) { FactoryGirl.create(:q_checkbox, validation_rules: validation_rules) }
18
- let(:answer) { FactoryGirl.build(:answer, question: question, answer_text: answer_text) }
17
+ let(:question) { FactoryBot.create(:q_checkbox, validation_rules: validation_rules) }
18
+ let(:answer) { FactoryBot.build(:answer, question: question, answer_text: answer_text) }
19
19
  before { answer.valid? }
20
20
 
21
21
  context "when there are no validation rules" do
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Rapidfire::Questions::Date do
4
4
  describe "validate_answer" do
5
- let(:question) { FactoryGirl.create(:q_date, validation_rules: validation_rules) }
6
- let(:answer) { FactoryGirl.build(:answer, question: question, answer_text: answer_text) }
5
+ let(:question) { FactoryBot.create(:q_date, validation_rules: validation_rules) }
6
+ let(:answer) { FactoryBot.build(:answer, question: question, answer_text: answer_text) }
7
7
  before { answer.valid? }
8
8
 
9
9
  context "when there are no validation rules" do
@@ -16,8 +16,8 @@ describe Rapidfire::Questions::File do
16
16
 
17
17
  if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" >= "5.2"
18
18
  describe "validate_answer" do
19
- let(:question) { FactoryGirl.create(:q_file, validation_rules: validation_rules) }
20
- let(:answer) { FactoryGirl.build(:answer, question: question, file: file) }
19
+ let(:question) { FactoryBot.create(:q_file, validation_rules: validation_rules) }
20
+ let(:answer) { FactoryBot.build(:answer, question: question, file: file) }
21
21
  before { answer.valid? }
22
22
 
23
23
  context "when there are no validation rules" do
@@ -16,8 +16,8 @@ describe Rapidfire::Questions::MultiFile do
16
16
 
17
17
  if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" >= "5.2"
18
18
  describe "validate_answer" do
19
- let(:question) { FactoryGirl.create(:q_multifile, validation_rules: validation_rules) }
20
- let(:answer) { FactoryGirl.build(:answer, question: question, files: files) }
19
+ let(:question) { FactoryBot.create(:q_multifile, validation_rules: validation_rules) }
20
+ let(:answer) { FactoryBot.build(:answer, question: question, files: files) }
21
21
  before { answer.valid? }
22
22
 
23
23
  context "when there are no validation rules" do
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe Rapidfire::Questions::Numeric do
4
4
  describe "validate_answer" do
5
- let(:question) { FactoryGirl.create(:q_numeric, validation_rules: validation_rules) }
6
- let(:answer) { FactoryGirl.build(:answer, question: question, answer_text: answer_text) }
5
+ let(:question) { FactoryBot.create(:q_numeric, validation_rules: validation_rules) }
6
+ let(:answer) { FactoryBot.build(:answer, question: question, answer_text: answer_text) }
7
7
  before { answer.valid? }
8
8
 
9
9
  context "when there are no validation rules" do
@@ -6,7 +6,7 @@ describe Rapidfire::Questions::Select do
6
6
  end
7
7
 
8
8
  describe "#options" do
9
- let(:question) { FactoryGirl.create(:q_select) }
9
+ let(:question) { FactoryBot.create(:q_select) }
10
10
 
11
11
  it "returns options" do
12
12
  expect(question.options).to match_array(["mac", "windows"])
@@ -14,8 +14,8 @@ describe Rapidfire::Questions::Select do
14
14
  end
15
15
 
16
16
  describe "validate_answer" do
17
- let(:question) { FactoryGirl.create(:q_select, validation_rules: validation_rules) }
18
- let(:answer) { FactoryGirl.build(:answer, question: question, answer_text: answer_text) }
17
+ let(:question) { FactoryBot.create(:q_select, validation_rules: validation_rules) }
18
+ let(:answer) { FactoryBot.build(:answer, question: question, answer_text: answer_text) }
19
19
  before { answer.valid? }
20
20
 
21
21
  context "when there are no validation rules" do
@@ -12,7 +12,7 @@ describe Rapidfire::Survey do
12
12
  end
13
13
 
14
14
  describe "factory" do
15
- let(:survey) { FactoryGirl.create(:survey) }
15
+ let(:survey) { FactoryBot.create(:survey) }
16
16
 
17
17
  it "has a name" do
18
18
  expect(survey.name).to eql("Test Survey")
@@ -4,7 +4,7 @@ describe Rapidfire::QuestionResultSerializer do
4
4
  include Rapidfire::QuestionSpecHelper
5
5
  include Rapidfire::AnswerSpecHelper
6
6
 
7
- let(:survey) { FactoryGirl.create(:survey) }
7
+ let(:survey) { FactoryBot.create(:survey) }
8
8
  let(:results) do
9
9
  Rapidfire::SurveyResults.new(survey: survey).extract
10
10
  end
@@ -5,9 +5,9 @@ def fixture_file_upload(path, mime_type)
5
5
  end
6
6
 
7
7
  describe Rapidfire::AttemptBuilder do
8
- let(:survey) { FactoryGirl.create(:survey) }
9
- let(:question1) { FactoryGirl.create(:q_short, survey: survey) }
10
- let(:question2) { FactoryGirl.create(:q_long, survey: survey,
8
+ let(:survey) { FactoryBot.create(:survey) }
9
+ let(:question1) { FactoryBot.create(:q_short, survey: survey) }
10
+ let(:question2) { FactoryBot.create(:q_long, survey: survey,
11
11
  validation_rules: { presence: "1" }) }
12
12
 
13
13
  describe "Creation" do
@@ -91,7 +91,7 @@ describe Rapidfire::AttemptBuilder do
91
91
 
92
92
  if "#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}" >= "5.2"
93
93
  context "with a single file upload question" do
94
- let(:question3) { FactoryGirl.create(:q_file, survey: survey) }
94
+ let(:question3) { FactoryBot.create(:q_file, survey: survey) }
95
95
 
96
96
  let(:answer_params) do
97
97
  {
@@ -111,7 +111,7 @@ describe Rapidfire::AttemptBuilder do
111
111
  end
112
112
 
113
113
  context "with multiple files upload question" do
114
- let(:question3) { FactoryGirl.create(:q_multifile, survey: survey) }
114
+ let(:question3) { FactoryBot.create(:q_multifile, survey: survey) }
115
115
 
116
116
  let(:answer_params) do
117
117
  {
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Rapidfire::QuestionForm do
4
- let(:survey) { FactoryGirl.create(:survey) }
4
+ let(:survey) { FactoryBot.create(:survey) }
5
5
 
6
6
  describe "Creation" do
7
7
  let(:proxy) { described_class.new(survey: survey) }
@@ -19,7 +19,7 @@ describe Rapidfire::QuestionForm do
19
19
  end
20
20
 
21
21
  context "when a question is passed" do
22
- let(:question) { FactoryGirl.create(:q_checkbox, survey: survey) }
22
+ let(:question) { FactoryBot.create(:q_checkbox, survey: survey) }
23
23
  let(:proxy) { described_class.new(survey: survey, question: question) }
24
24
 
25
25
  it "persists question params" do
@@ -75,7 +75,7 @@ describe Rapidfire::QuestionForm do
75
75
  end
76
76
 
77
77
  context "updating a question" do
78
- let(:question) { FactoryGirl.create(:q_checkbox, survey: survey) }
78
+ let(:question) { FactoryBot.create(:q_checkbox, survey: survey) }
79
79
  let(:proxy) do
80
80
  proxy_params = params.merge(survey: survey, question: question)
81
81
  described_class.new(proxy_params)
@@ -4,7 +4,7 @@ describe Rapidfire::SurveyResults do
4
4
  include Rapidfire::QuestionSpecHelper
5
5
  include Rapidfire::AnswerSpecHelper
6
6
 
7
- let(:survey) { FactoryGirl.create(:survey) }
7
+ let(:survey) { FactoryBot.create(:survey) }
8
8
 
9
9
  describe '#extract' do
10
10
  before do
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ require File.expand_path("../dummy/config/environment", __FILE__)
4
4
  require 'rspec/rails'
5
5
 
6
6
  require 'capybara/rails'
7
- require 'factory_girl_rails'
7
+ require 'factory_bot_rails'
8
8
  require 'database_cleaner'
9
9
  require 'shoulda'
10
10
 
@@ -1,22 +1,22 @@
1
1
  module Rapidfire
2
2
  module AnswerSpecHelper
3
3
  def create_answers
4
- FactoryGirl.create(:answer, :question => @question_checkbox, :answer_text => 'hindi')
5
- FactoryGirl.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\ntelugu")
6
- FactoryGirl.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\nkannada")
4
+ FactoryBot.create(:answer, :question => @question_checkbox, :answer_text => 'hindi')
5
+ FactoryBot.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\ntelugu")
6
+ FactoryBot.create(:answer, :question => @question_checkbox, :answer_text => "hindi\r\nkannada")
7
7
 
8
- FactoryGirl.create(:answer, :question => @question_select, :answer_text => 'mac')
9
- FactoryGirl.create(:answer, :question => @question_select, :answer_text => 'mac')
10
- FactoryGirl.create(:answer, :question => @question_select, :answer_text => 'windows')
8
+ FactoryBot.create(:answer, :question => @question_select, :answer_text => 'mac')
9
+ FactoryBot.create(:answer, :question => @question_select, :answer_text => 'mac')
10
+ FactoryBot.create(:answer, :question => @question_select, :answer_text => 'windows')
11
11
 
12
- FactoryGirl.create(:answer, :question => @question_radio, :answer_text => 'male')
13
- FactoryGirl.create(:answer, :question => @question_radio, :answer_text => 'female')
12
+ FactoryBot.create(:answer, :question => @question_radio, :answer_text => 'male')
13
+ FactoryBot.create(:answer, :question => @question_radio, :answer_text => 'female')
14
14
 
15
15
  3.times do
16
- FactoryGirl.create(:answer, :question => @question_date, :answer_text => Date.today.to_s)
17
- FactoryGirl.create(:answer, :question => @question_long, :answer_text => 'my bio goes on and on!')
18
- FactoryGirl.create(:answer, :question => @question_numeric, :answer_text => 999)
19
- FactoryGirl.create(:answer, :question => @question_short, :answer_text => 'this is cool')
16
+ FactoryBot.create(:answer, :question => @question_date, :answer_text => Date.today.to_s)
17
+ FactoryBot.create(:answer, :question => @question_long, :answer_text => 'my bio goes on and on!')
18
+ FactoryBot.create(:answer, :question => @question_numeric, :answer_text => 999)
19
+ FactoryBot.create(:answer, :question => @question_short, :answer_text => 'this is cool')
20
20
  end
21
21
  end
22
22
  end
@@ -1,13 +1,13 @@
1
1
  module Rapidfire
2
2
  module QuestionSpecHelper
3
3
  def create_questions(survey)
4
- @question_checkbox = FactoryGirl.create(:q_checkbox, :survey => survey)
5
- @question_date = FactoryGirl.create(:q_date, :survey => survey)
6
- @question_long = FactoryGirl.create(:q_long, :survey => survey)
7
- @question_numeric = FactoryGirl.create(:q_numeric, :survey => survey)
8
- @question_radio = FactoryGirl.create(:q_radio, :survey => survey)
9
- @question_select = FactoryGirl.create(:q_select, :survey => survey)
10
- @question_short = FactoryGirl.create(:q_short, :survey => survey)
4
+ @question_checkbox = FactoryBot.create(:q_checkbox, :survey => survey)
5
+ @question_date = FactoryBot.create(:q_date, :survey => survey)
6
+ @question_long = FactoryBot.create(:q_long, :survey => survey)
7
+ @question_numeric = FactoryBot.create(:q_numeric, :survey => survey)
8
+ @question_radio = FactoryBot.create(:q_radio, :survey => survey)
9
+ @question_select = FactoryBot.create(:q_select, :survey => survey)
10
+ @question_short = FactoryBot.create(:q_short, :survey => survey)
11
11
  end
12
12
  end
13
13
  end
@@ -9,18 +9,18 @@ describe 'rapidfire:change_delimiter_from_comma_to_srsn' do
9
9
  end
10
10
 
11
11
  it 'converts select,radio and checkbox answer options delimiter from , to \r\n' do
12
- survey = FactoryGirl.create(:survey)
13
- q_checkbox = FactoryGirl.create(:q_checkbox, survey: survey,
12
+ survey = FactoryBot.create(:survey)
13
+ q_checkbox = FactoryBot.create(:q_checkbox, survey: survey,
14
14
  answer_options: 'one,two,three')
15
- q_radio = FactoryGirl.create(:q_radio, survey: survey,
15
+ q_radio = FactoryBot.create(:q_radio, survey: survey,
16
16
  answer_options: 'hello,world')
17
- q_select = FactoryGirl.create(:q_select, survey: survey,
17
+ q_select = FactoryBot.create(:q_select, survey: survey,
18
18
  answer_options: 'new,old,historic,')
19
19
 
20
- q_date = FactoryGirl.create(:q_date, survey: survey)
21
- q_long = FactoryGirl.create(:q_long, survey: survey)
22
- q_numeric = FactoryGirl.create(:q_numeric, survey: survey)
23
- q_short = FactoryGirl.create(:q_short, survey: survey)
20
+ q_date = FactoryBot.create(:q_date, survey: survey)
21
+ q_long = FactoryBot.create(:q_long, survey: survey)
22
+ q_numeric = FactoryBot.create(:q_numeric, survey: survey)
23
+ q_short = FactoryBot.create(:q_short, survey: survey)
24
24
 
25
25
  Rake::Task['rapidfire:change_delimiter_from_comma_to_srsn'].invoke
26
26