helena 1.1.0 → 1.3.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 (61) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -2
  3. data/.rubocop.yml +4 -0
  4. data/.travis.yml +5 -4
  5. data/Appraisals +12 -0
  6. data/Gemfile +8 -11
  7. data/Gemfile.lock +217 -200
  8. data/README.md +2 -3
  9. data/Rakefile +2 -0
  10. data/app/controllers/helena/sessions_controller.rb +2 -2
  11. data/app/models/helena/answer.rb +5 -3
  12. data/app/models/helena/concerns/application_model.rb +1 -1
  13. data/app/models/helena/question.rb +1 -1
  14. data/app/models/helena/question_group.rb +1 -1
  15. data/app/models/helena/questions/checkbox_group.rb +1 -1
  16. data/app/models/helena/session.rb +3 -3
  17. data/app/models/helena/version.rb +1 -1
  18. data/config/initializers/simple_form_bootstrap.rb +1 -1
  19. data/db/seeds.rb +7 -6
  20. data/gemfiles/rails_4.2.gemfile +22 -0
  21. data/gemfiles/rails_4.2.gemfile.lock +295 -0
  22. data/gemfiles/rails_5.1.gemfile +24 -0
  23. data/gemfiles/rails_5.1.gemfile.lock +305 -0
  24. data/helena.gemspec +7 -7
  25. data/lib/helena/engine.rb +2 -2
  26. data/lib/helena/survey_importer.rb +1 -1
  27. data/lib/helena/version.rb +1 -1
  28. data/lib/helena/version_publisher.rb +2 -2
  29. data/spec/controllers/helena/sessions_controller_spec.rb +5 -5
  30. data/spec/dummy/app/views/layouts/application.html.haml +1 -3
  31. data/spec/dummy/bin/rails +1 -1
  32. data/spec/dummy/config/environments/development.rb +2 -0
  33. data/spec/dummy/config/environments/test.rb +0 -4
  34. data/spec/dummy/config.ru +1 -1
  35. data/spec/factories/helena/answers.rb +7 -7
  36. data/spec/factories/helena/labels.rb +3 -2
  37. data/spec/factories/helena/question_groups.rb +3 -2
  38. data/spec/factories/helena/questions.rb +3 -2
  39. data/spec/factories/helena/sessions.rb +6 -2
  40. data/spec/factories/helena/sub_questions.rb +3 -2
  41. data/spec/factories/helena/survey_details.rb +4 -3
  42. data/spec/factories/helena/surveys.rb +2 -2
  43. data/spec/factories/helena/versions.rb +3 -1
  44. data/spec/features/helena/manage_session_spec.rb +5 -5
  45. data/spec/lib/version_publisher_spec.rb +1 -1
  46. data/spec/models/helena/answer_spec.rb +1 -1
  47. data/spec/models/helena/label_spec.rb +1 -1
  48. data/spec/models/helena/question_group_spec.rb +1 -1
  49. data/spec/models/helena/question_spec.rb +1 -1
  50. data/spec/models/helena/questions/bipolar_radio_matrix_spec.rb +1 -1
  51. data/spec/models/helena/questions/checkbox_group_spec.rb +1 -1
  52. data/spec/models/helena/questions/radio_group_spec.rb +1 -1
  53. data/spec/models/helena/questions/radio_matrix_spec.rb +1 -1
  54. data/spec/models/helena/questions/short_text_spec.rb +1 -1
  55. data/spec/models/helena/session_spec.rb +3 -3
  56. data/spec/models/helena/sub_question_spec.rb +1 -1
  57. data/spec/models/helena/survey_spec.rb +1 -1
  58. data/spec/models/helena/version_spec.rb +1 -1
  59. data/spec/spec_helper.rb +4 -7
  60. data/spec/support/rails_compatibility.rb +4 -0
  61. metadata +38 -39
@@ -0,0 +1,305 @@
1
+ GIT
2
+ remote: https://github.com/mongoid-rspec/mongoid-rspec.git
3
+ revision: f392d24abc6853895bd959b4916cd82a1b12f6f4
4
+ specs:
5
+ mongoid-rspec (4.0.0.pre.alpha1)
6
+ activesupport (>= 4.0.0)
7
+ mongoid (~> 6.0)
8
+ rspec (~> 3.3)
9
+
10
+ PATH
11
+ remote: ..
12
+ specs:
13
+ helena (1.3.0)
14
+ bootstrap-sass (~> 3.2)
15
+ browser (~> 2.0)
16
+ haml-rails (~> 1.0)
17
+ jquery-rails (~> 4.0)
18
+ mongoid (>= 4.0)
19
+ mongoid-simple-tags (~> 0.1)
20
+ mongoid-tree (~> 2.0)
21
+ mongoid_orderable (~> 4.1)
22
+ rails (>= 4.2)
23
+ rails-i18n (>= 4.0)
24
+ responders (~> 2.0)
25
+ sass-rails (~> 5.0)
26
+ simple_form (~> 3.2)
27
+ slim (~> 3.0)
28
+
29
+ GEM
30
+ remote: https://rubygems.org/
31
+ specs:
32
+ actioncable (5.1.0)
33
+ actionpack (= 5.1.0)
34
+ nio4r (~> 2.0)
35
+ websocket-driver (~> 0.6.1)
36
+ actionmailer (5.1.0)
37
+ actionpack (= 5.1.0)
38
+ actionview (= 5.1.0)
39
+ activejob (= 5.1.0)
40
+ mail (~> 2.5, >= 2.5.4)
41
+ rails-dom-testing (~> 2.0)
42
+ actionpack (5.1.0)
43
+ actionview (= 5.1.0)
44
+ activesupport (= 5.1.0)
45
+ rack (~> 2.0)
46
+ rack-test (~> 0.6.3)
47
+ rails-dom-testing (~> 2.0)
48
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
49
+ actionview (5.1.0)
50
+ activesupport (= 5.1.0)
51
+ builder (~> 3.1)
52
+ erubi (~> 1.4)
53
+ rails-dom-testing (~> 2.0)
54
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
55
+ activejob (5.1.0)
56
+ activesupport (= 5.1.0)
57
+ globalid (>= 0.3.6)
58
+ activemodel (5.1.0)
59
+ activesupport (= 5.1.0)
60
+ activerecord (5.1.0)
61
+ activemodel (= 5.1.0)
62
+ activesupport (= 5.1.0)
63
+ arel (~> 8.0)
64
+ activesupport (5.1.0)
65
+ concurrent-ruby (~> 1.0, >= 1.0.2)
66
+ i18n (~> 0.7)
67
+ minitest (~> 5.1)
68
+ tzinfo (~> 1.1)
69
+ addressable (2.5.2)
70
+ public_suffix (>= 2.0.2, < 4.0)
71
+ appraisal (2.2.0)
72
+ bundler
73
+ rake
74
+ thor (>= 0.14.0)
75
+ arel (8.0.0)
76
+ autoprefixer-rails (7.1.6)
77
+ execjs
78
+ better_errors (2.4.0)
79
+ coderay (>= 1.0.0)
80
+ erubi (>= 1.0.0)
81
+ rack (>= 0.9.0)
82
+ binding_of_caller (0.7.3)
83
+ debug_inspector (>= 0.0.1)
84
+ bootstrap-sass (3.3.7)
85
+ autoprefixer-rails (>= 5.2.1)
86
+ sass (>= 3.3.4)
87
+ browser (2.5.2)
88
+ bson (4.2.2)
89
+ builder (3.2.3)
90
+ byebug (9.1.0)
91
+ capybara (2.15.4)
92
+ addressable
93
+ mini_mime (>= 0.1.3)
94
+ nokogiri (>= 1.3.3)
95
+ rack (>= 1.0.0)
96
+ rack-test (>= 0.5.4)
97
+ xpath (~> 2.0)
98
+ childprocess (0.8.0)
99
+ ffi (~> 1.0, >= 1.0.11)
100
+ coderay (1.1.2)
101
+ concurrent-ruby (1.0.5)
102
+ crass (1.0.2)
103
+ debug_inspector (0.0.3)
104
+ diff-lcs (1.3)
105
+ erubi (1.7.0)
106
+ erubis (2.7.0)
107
+ execjs (2.7.0)
108
+ factory_bot (4.8.2)
109
+ activesupport (>= 3.0.0)
110
+ factory_bot_rails (4.8.2)
111
+ factory_bot (~> 4.8.2)
112
+ railties (>= 3.0.0)
113
+ faker (1.8.4)
114
+ i18n (~> 0.5)
115
+ ffi (1.9.18)
116
+ globalid (0.4.1)
117
+ activesupport (>= 4.2.0)
118
+ haml (5.0.4)
119
+ temple (>= 0.8.0)
120
+ tilt
121
+ haml-rails (1.0.0)
122
+ actionpack (>= 4.0.1)
123
+ activesupport (>= 4.0.1)
124
+ haml (>= 4.0.6, < 6.0)
125
+ html2haml (>= 1.0.1)
126
+ railties (>= 4.0.1)
127
+ html2haml (2.2.0)
128
+ erubis (~> 2.7.0)
129
+ haml (>= 4.0, < 6)
130
+ nokogiri (>= 1.6.0)
131
+ ruby_parser (~> 3.5)
132
+ i18n (0.9.1)
133
+ concurrent-ruby (~> 1.0)
134
+ jquery-rails (4.3.1)
135
+ rails-dom-testing (>= 1, < 3)
136
+ railties (>= 4.2.0)
137
+ thor (>= 0.14, < 2.0)
138
+ json (1.8.6)
139
+ launchy (2.4.3)
140
+ addressable (~> 2.3)
141
+ loofah (2.1.1)
142
+ crass (~> 1.0.2)
143
+ nokogiri (>= 1.5.9)
144
+ mail (2.7.0)
145
+ mini_mime (>= 0.1.1)
146
+ method_source (0.9.0)
147
+ mini_mime (0.1.4)
148
+ mini_portile2 (2.3.0)
149
+ minitest (5.10.3)
150
+ mongo (2.4.3)
151
+ bson (>= 4.2.1, < 5.0.0)
152
+ mongoid (6.2.1)
153
+ activemodel (~> 5.1)
154
+ mongo (>= 2.4.1, < 3.0.0)
155
+ mongoid-simple-tags (0.1.3)
156
+ json (~> 1.8)
157
+ mongoid (>= 3.0.3)
158
+ mongoid-tree (2.1.0)
159
+ mongoid (>= 4.0, < 7.0)
160
+ mongoid_orderable (4.1.1)
161
+ mongoid
162
+ nio4r (2.1.0)
163
+ nokogiri (1.8.1)
164
+ mini_portile2 (~> 2.3.0)
165
+ pry (0.11.2)
166
+ coderay (~> 1.1.0)
167
+ method_source (~> 0.9.0)
168
+ pry-byebug (3.5.0)
169
+ byebug (~> 9.1)
170
+ pry (~> 0.10)
171
+ public_suffix (3.0.0)
172
+ rack (2.0.3)
173
+ rack-test (0.6.3)
174
+ rack (>= 1.0)
175
+ rails (5.1.0)
176
+ actioncable (= 5.1.0)
177
+ actionmailer (= 5.1.0)
178
+ actionpack (= 5.1.0)
179
+ actionview (= 5.1.0)
180
+ activejob (= 5.1.0)
181
+ activemodel (= 5.1.0)
182
+ activerecord (= 5.1.0)
183
+ activesupport (= 5.1.0)
184
+ bundler (>= 1.3.0, < 2.0)
185
+ railties (= 5.1.0)
186
+ sprockets-rails (>= 2.0.0)
187
+ rails-dom-testing (2.0.3)
188
+ activesupport (>= 4.2.0)
189
+ nokogiri (>= 1.6)
190
+ rails-html-sanitizer (1.0.3)
191
+ loofah (~> 2.0)
192
+ rails-i18n (5.0.4)
193
+ i18n (~> 0.7)
194
+ railties (~> 5.0)
195
+ railties (5.1.0)
196
+ actionpack (= 5.1.0)
197
+ activesupport (= 5.1.0)
198
+ method_source
199
+ rake (>= 0.8.7)
200
+ thor (>= 0.18.1, < 2.0)
201
+ rake (12.2.1)
202
+ rb-fsevent (0.10.2)
203
+ rb-inotify (0.9.10)
204
+ ffi (>= 0.5.0, < 2)
205
+ responders (2.4.0)
206
+ actionpack (>= 4.2.0, < 5.3)
207
+ railties (>= 4.2.0, < 5.3)
208
+ rspec (3.7.0)
209
+ rspec-core (~> 3.7.0)
210
+ rspec-expectations (~> 3.7.0)
211
+ rspec-mocks (~> 3.7.0)
212
+ rspec-collection_matchers (1.1.3)
213
+ rspec-expectations (>= 2.99.0.beta1)
214
+ rspec-core (3.7.0)
215
+ rspec-support (~> 3.7.0)
216
+ rspec-expectations (3.7.0)
217
+ diff-lcs (>= 1.2.0, < 2.0)
218
+ rspec-support (~> 3.7.0)
219
+ rspec-mocks (3.7.0)
220
+ diff-lcs (>= 1.2.0, < 2.0)
221
+ rspec-support (~> 3.7.0)
222
+ rspec-rails (3.7.1)
223
+ actionpack (>= 3.0)
224
+ activesupport (>= 3.0)
225
+ railties (>= 3.0)
226
+ rspec-core (~> 3.7.0)
227
+ rspec-expectations (~> 3.7.0)
228
+ rspec-mocks (~> 3.7.0)
229
+ rspec-support (~> 3.7.0)
230
+ rspec-support (3.7.0)
231
+ ruby-progressbar (1.9.0)
232
+ ruby_parser (3.10.1)
233
+ sexp_processor (~> 4.9)
234
+ rubyzip (1.2.1)
235
+ sass (3.5.3)
236
+ sass-listen (~> 4.0.0)
237
+ sass-listen (4.0.0)
238
+ rb-fsevent (~> 0.9, >= 0.9.4)
239
+ rb-inotify (~> 0.9, >= 0.9.7)
240
+ sass-rails (5.0.6)
241
+ railties (>= 4.0.0, < 6)
242
+ sass (~> 3.1)
243
+ sprockets (>= 2.8, < 4.0)
244
+ sprockets-rails (>= 2.0, < 4.0)
245
+ tilt (>= 1.1, < 3)
246
+ selenium-webdriver (3.7.0)
247
+ childprocess (~> 0.5)
248
+ rubyzip (~> 1.0)
249
+ sexp_processor (4.10.0)
250
+ shoulda-matchers (3.1.2)
251
+ activesupport (>= 4.0.0)
252
+ simple_form (3.5.0)
253
+ actionpack (> 4, < 5.2)
254
+ activemodel (> 4, < 5.2)
255
+ slim (3.0.8)
256
+ temple (>= 0.7.6, < 0.9)
257
+ tilt (>= 1.3.3, < 2.1)
258
+ sprockets (3.7.1)
259
+ concurrent-ruby (~> 1.0)
260
+ rack (> 1, < 3)
261
+ sprockets-rails (3.2.1)
262
+ actionpack (>= 4.0)
263
+ activesupport (>= 4.0)
264
+ sprockets (>= 3.0.0)
265
+ temple (0.8.0)
266
+ thor (0.20.0)
267
+ thread_safe (0.3.6)
268
+ tilt (2.0.8)
269
+ tzinfo (1.2.4)
270
+ thread_safe (~> 0.1)
271
+ websocket-driver (0.6.5)
272
+ websocket-extensions (>= 0.1.0)
273
+ websocket-extensions (0.1.2)
274
+ xpath (2.1.0)
275
+ nokogiri (~> 1.3)
276
+
277
+ PLATFORMS
278
+ ruby
279
+
280
+ DEPENDENCIES
281
+ appraisal
282
+ better_errors
283
+ binding_of_caller
284
+ bootstrap-sass
285
+ capybara (~> 2.3)
286
+ factory_bot_rails
287
+ faker (~> 1.4)
288
+ helena!
289
+ jquery-rails
290
+ launchy
291
+ mongoid (>= 6.0)
292
+ mongoid-rspec!
293
+ pry
294
+ pry-byebug
295
+ rails (= 5.1)
296
+ rake
297
+ rspec-collection_matchers (~> 1)
298
+ rspec-rails (~> 3)
299
+ ruby-progressbar
300
+ selenium-webdriver
301
+ shoulda-matchers
302
+ simple_form
303
+
304
+ BUNDLED WITH
305
+ 1.16.0.pre.3
data/helena.gemspec CHANGED
@@ -19,25 +19,25 @@ survey/test development, longitudinal studies and instant feedback.'
19
19
  s.files = `git ls-files`.split("\n")
20
20
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
21
21
 
22
- s.add_dependency 'rails', '~> 4.2'
23
- s.add_dependency 'mongoid', ['< 6.0', '>= 4.0']
22
+ s.add_dependency 'rails', '>= 4.2'
23
+ s.add_dependency 'mongoid', '>= 4.0'
24
24
  s.add_dependency 'mongoid_orderable', '~> 4.1'
25
- s.add_dependency 'mongoid-simple-tags', '~> 0.1'
26
- s.add_dependency 'haml-rails', '~> 0.9'
25
+ s.add_dependency 'mongoid-simple-tags', '>= 0.1.3'
26
+ s.add_dependency 'haml-rails', '~> 1.0'
27
27
  s.add_dependency 'slim', '~> 3.0'
28
28
  s.add_dependency 'jquery-rails', '~> 4.0'
29
29
  s.add_dependency 'sass-rails', '~> 5.0'
30
30
  s.add_dependency 'bootstrap-sass', '~> 3.2'
31
31
  s.add_dependency 'simple_form', '~> 3.2'
32
- s.add_dependency 'breadcrumbs_on_rails', '~> 2.3'
33
- s.add_dependency 'rails-i18n', '~> 4.0'
32
+ s.add_dependency 'rails-i18n', '>= 4.0'
34
33
  s.add_dependency 'responders', '~> 2.0'
35
34
  s.add_dependency 'browser', '~> 2.0'
36
35
  s.add_dependency 'mongoid-tree', '~> 2.0'
37
36
 
38
37
  s.add_development_dependency 'rspec-rails', '~> 3'
39
38
  s.add_development_dependency 'rspec-collection_matchers', '~> 1'
40
- s.add_development_dependency 'factory_girl_rails', '~> 4.4'
39
+ s.add_development_dependency 'factory_bot_rails'
41
40
  s.add_development_dependency 'faker', '~> 1.4'
42
41
  s.add_development_dependency 'capybara', '~> 2.3'
42
+ s.add_development_dependency "appraisal"
43
43
  end
data/lib/helena/engine.rb CHANGED
@@ -4,8 +4,8 @@ module Helena
4
4
  config.i18n.load_path += Dir[config.root.join('config', 'locales', '**', '*.{rb,yml}').to_s]
5
5
 
6
6
  # Thanks to https://github.com/thoughtbot/factory_girl_rails/pull/42
7
- initializer 'helena.factories', after: 'factory_girl.set_factory_paths' do
8
- FactoryGirl.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryGirl)
7
+ initializer 'helena.factories', after: 'factory_bot.set_factory_paths' do
8
+ FactoryBot.definition_file_paths << File.expand_path('../../../spec/factories', __FILE__) if defined?(FactoryBot)
9
9
  end
10
10
 
11
11
  config.to_prepare do
@@ -5,7 +5,7 @@ module Helena
5
5
  attr_accessor :survey
6
6
 
7
7
  def initialize(yaml_string)
8
- @parsed = YAML.load yaml_string
8
+ @parsed = YAML.safe_load yaml_string
9
9
 
10
10
  create_survey
11
11
  end
@@ -1,3 +1,3 @@
1
1
  module Helena
2
- VERSION = '1.1.0'
2
+ VERSION = '1.3.0'.freeze
3
3
  end
@@ -17,8 +17,8 @@ module Helena
17
17
  def self.adjust_copied_attributes(version, copied_version)
18
18
  copied_version.version = newest_version_of(version.survey) + 1
19
19
  copied_version.survey_detail = version.survey_detail.attributes if version.survey_detail
20
- copied_version.created_at = DateTime.now
21
- copied_version.updated_at = DateTime.now
20
+ copied_version.created_at = Time.now
21
+ copied_version.updated_at = Time.now
22
22
  copied_version.active = false
23
23
  copied_version
24
24
  end
@@ -15,19 +15,19 @@ describe Helena::SessionsController do
15
15
  context 'version not active' do
16
16
  before { version.update_attribute :active, false }
17
17
 
18
- it 'raises not found when editing' do
19
- get :edit, token: session.token
18
+ it 'raises not found when editing' do
19
+ get :edit, parametrize(token: session.token)
20
20
  is_expected.to respond_with :not_found
21
21
  end
22
22
 
23
23
  it 'raises not found when updating' do
24
- patch :update, token: session.token
24
+ patch :update, parametrize(token: session.token)
25
25
  is_expected.to respond_with :not_found
26
26
  end
27
27
  end
28
28
 
29
29
  it 'return json result of the current session' do
30
- get :show, token: session.view_token, format: :json
30
+ get :show, parametrize(token: session.view_token).merge(format: :json)
31
31
 
32
32
  result = ActiveSupport::JSON.decode(response.body)
33
33
  expect(result['answer']['string_answer_1']).to eq 'abc'
@@ -36,7 +36,7 @@ describe Helena::SessionsController do
36
36
 
37
37
  it 'renders session_report as slim template' do
38
38
  session.version.update_attribute :session_report, 'h1 make it slim!'
39
- get :show, token: session.view_token
39
+ get :show, parametrize(token: session.view_token)
40
40
 
41
41
  expect(response.body).to eq '<h1>make it slim!</h1>'
42
42
  end
@@ -1,7 +1,7 @@
1
1
  !!!
2
2
  %html
3
3
  %head
4
- %title= strip_tags(render_breadcrumbs separator: '/')
4
+ %title Helena
5
5
  = stylesheet_link_tag 'helena/application', media: 'all'
6
6
  = javascript_include_tag 'helena/application'
7
7
  %meta{ name: 'viewport', content: 'initial-scale=1.0' }
@@ -19,6 +19,4 @@
19
19
  %li= message
20
20
  %h1.hidden
21
21
  Helena
22
- %ol.breadcrumb
23
- = render_breadcrumbs tag: :li, separator: ''
24
22
  = yield
data/spec/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -26,4 +26,6 @@ Dummy::Application.configure do
26
26
  # This option may cause significant delays in view rendering with a large
27
27
  # number of complex assets.
28
28
  config.assets.debug = true
29
+
30
+ config.assets.quiet = true
29
31
  end
@@ -12,10 +12,6 @@ Dummy::Application.configure do
12
12
  # preloads Rails for running tests, you may have to set it to true.
13
13
  config.eager_load = false
14
14
 
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = 'public, max-age=3600'
18
-
19
15
  # Show full error reports and disable caching.
20
16
  config.consider_all_requests_local = true
21
17
  config.action_controller.perform_caching = false
data/spec/dummy/config.ru CHANGED
@@ -1,4 +1,4 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require ::File.expand_path('../config/environment', __FILE__)
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
4
  run Rails.application
@@ -1,24 +1,24 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :answer, class: Helena::Answer do
3
- sequence(:code) { |n| "answer_#{n}" }
4
- sequence(:ip_address) { Faker::Internet.ip_v4_address }
3
+ sequence(:code) { |n| "answer_#{n}" }
4
+ sequence(:ip_address) { Faker::Internet.ip_v4_address }
5
5
  end
6
6
 
7
7
  factory :string_answer, class: Helena::StringAnswer do
8
8
  sequence(:code) { |n| "string_answer_#{n}" }
9
- sequence(:value) { Faker::Skill.tech_skill }
10
- sequence(:ip_address) { Faker::Internet.ip_v4_address }
9
+ sequence(:value) { Faker::Lorem.word }
10
+ sequence(:ip_address) { Faker::Internet.ip_v4_address }
11
11
  end
12
12
 
13
13
  factory :integer_answer, class: Helena::IntegerAnswer do
14
14
  sequence(:code) { |n| "integer_answer_#{n}" }
15
15
  sequence(:value) { rand 99 }
16
- sequence(:ip_address) { Faker::Internet.ip_v4_address }
16
+ sequence(:ip_address) { Faker::Internet.ip_v4_address }
17
17
  end
18
18
 
19
19
  factory :boolean_answer, class: Helena::BooleanAnswer do
20
20
  sequence(:code) { |n| "boolean_answer_#{n}" }
21
21
  sequence(:value) { [true, false].sample }
22
- sequence(:ip_address) { Faker::Internet.ip_v4_address }
22
+ sequence(:ip_address) { Faker::Internet.ip_v4_address }
23
23
  end
24
24
  end
@@ -1,6 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :label, class: Helena::Label do
3
- sequence(:text) { |n| "Option #{n}" }
3
+ sequence(:text) { |n| "Option #{n}" }
4
4
  sequence(:value)
5
+ question
5
6
  end
6
7
  end
@@ -1,5 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :question_group, class: Helena::QuestionGroup do
3
- sequence(:title) { |n| "Page #{n}" }
3
+ sequence(:title) { |n| "Page #{n}" }
4
+ version
4
5
  end
5
6
  end
@@ -1,7 +1,8 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :question, class: Helena::Question do
3
- sequence(:question_text) { |n| "Question #{n}, #{Faker::Lorem.words(3).join(' ')}?" }
3
+ sequence(:question_text) { |n| "Question #{n}, #{Faker::Lorem.words(3).join(' ')}?" }
4
4
  sequence(:code) { |n| "x#{n}" }
5
+ question_group
5
6
 
6
7
  factory :short_text_question, class: Helena::Questions::ShortText
7
8
  factory :static_text_question, class: Helena::Questions::StaticText
@@ -1,8 +1,12 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :session, class: Helena::Session do
3
- sequence(:token) { |n| "token_#{n}" }
3
+ sequence(:token) { |n| "token_#{n}" }
4
+ survey
5
+ version
4
6
  end
5
7
 
6
8
  factory :session_without_token, class: Helena::Session do
9
+ survey
10
+ version
7
11
  end
8
12
  end
@@ -1,6 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :sub_question, class: Helena::SubQuestion do
3
- sequence(:text) { |n| "Question #{n}, #{Faker::Lorem.words(3).join(' ')}?" }
3
+ sequence(:text) { |n| "Question #{n}, #{Faker::Lorem.words(3).join(' ')}?" }
4
4
  sequence(:code) { |n| "y#{n}" }
5
+ question
5
6
  end
6
7
  end
@@ -1,6 +1,7 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :survey_detail, class: Helena::SurveyDetail do
3
- sequence(:title) { |n| "Survey #{n}, #{Faker::Lorem.words(3).join(' ')}?" }
4
- sequence(:description) { Faker::Lorem.paragraphs(3).join(' ') }
3
+ sequence(:title) { |n| "Survey #{n}, #{Faker::Lorem.words(3).join(' ')}?" }
4
+ sequence(:description) { Faker::Lorem.paragraphs(3).join(' ') }
5
+ version
5
6
  end
6
7
  end
@@ -1,6 +1,6 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :survey, class: Helena::Survey do
3
- sequence(:name) { |n| "Survey #{n}" }
3
+ sequence(:name) { |n| "Survey #{n}" }
4
4
  language 'en'
5
5
  end
6
6
  end
@@ -1,11 +1,13 @@
1
- FactoryGirl.define do
1
+ FactoryBot.define do
2
2
  factory :version, class: Helena::Version do
3
3
  sequence(:version)
4
4
  notes { Faker::Lorem.paragraphs(1).join('') }
5
+ survey
5
6
  end
6
7
 
7
8
  factory :base_version, class: Helena::Version do
8
9
  version { 0 }
9
10
  notes { Faker::Lorem.paragraphs(1).join('') }
11
+ survey
10
12
  end
11
13
  end
@@ -10,10 +10,10 @@ feature 'Session management' do
10
10
  end
11
11
 
12
12
  scenario 'edits a session' do
13
- short_text_question = build :short_text_question, code: 'a_name', question_text: "What's your name?"
13
+ short_text_question = build :short_text_question, code: 'a_name', question_text: "What's your name?"
14
14
  first_question_group.questions << short_text_question
15
15
 
16
- long_text_question = build :long_text_question, code: 'selfdescription', question_text: 'Give a brief description of yourself'
16
+ long_text_question = build :long_text_question, code: 'selfdescription', question_text: 'Give a brief description of yourself'
17
17
  first_question_group.questions << long_text_question
18
18
 
19
19
  second_question_group = base_version.question_groups.create title: 'Question Group 2', allow_to_go_back: true
@@ -167,7 +167,7 @@ feature 'Session management' do
167
167
  end
168
168
 
169
169
  scenario 'does not save an empty short text field when required' do
170
- short_text_question = build :short_text_question, code: 'a_name', question_text: "What's your name?", required: true
170
+ short_text_question = build :short_text_question, code: 'a_name', question_text: "What's your name?", required: true
171
171
  first_question_group.questions << short_text_question
172
172
 
173
173
  session = survey.sessions.create version_id: base_version.id, token: 'abc'
@@ -181,7 +181,7 @@ feature 'Session management' do
181
181
  end
182
182
 
183
183
  scenario 'does not display "* indicates required fields" when no required fields are in question group' do
184
- short_text_question = build :short_text_question, code: 'a_name', question_text: "What's your name?", required: false
184
+ short_text_question = build :short_text_question, code: 'a_name', question_text: "What's your name?", required: false
185
185
  first_question_group.questions << short_text_question
186
186
 
187
187
  session = survey.sessions.create version_id: base_version.id, token: 'abc'
@@ -193,7 +193,7 @@ feature 'Session management' do
193
193
  end
194
194
 
195
195
  scenario 'does not save an empty long text field when required' do
196
- long_text_question = build :long_text_question, code: 'selfdescription', question_text: 'Give a brief description of yourself', required: true
196
+ long_text_question = build :long_text_question, code: 'selfdescription', question_text: 'Give a brief description of yourself', required: true
197
197
  first_question_group.questions << long_text_question
198
198
 
199
199
  session = survey.sessions.create version_id: base_version.id, token: 'abc'
@@ -10,7 +10,7 @@ describe Helena::VersionPublisher do
10
10
  let!(:sub_question) { create(:sub_question, text: 'ymca', code: 'cde', question: question) }
11
11
 
12
12
  it 'creates a new version' do
13
- allow(DateTime).to receive(:now).and_return('Tue, 24 Jun 2014 10:24:08 +0200')
13
+ allow(Time).to receive(:now).and_return(Time.parse('Tue, 24 Jun 2014 10:24:08 +0200'))
14
14
 
15
15
  new_version = Helena::VersionPublisher.publish(source_version)
16
16
  new_version.save
@@ -15,7 +15,7 @@ describe Helena::Answer do
15
15
  end
16
16
 
17
17
  it 'has a valid factory' do
18
- expect(build :answer).to be_valid
18
+ expect(build(:answer)).to be_valid
19
19
  end
20
20
 
21
21
  describe '.build_generic' do
@@ -6,6 +6,6 @@ describe Helena::Label do
6
6
  it { expect(subject).to validate_uniqueness_of(:value) }
7
7
 
8
8
  it 'has a valid factory' do
9
- expect(build :label).to be_valid
9
+ expect(build(:label)).to be_valid
10
10
  end
11
11
  end
@@ -7,6 +7,6 @@ describe Helena::QuestionGroup do
7
7
  it { expect(subject).to belong_to(:version) }
8
8
 
9
9
  it 'has a valid factory' do
10
- expect(build :question_group).to be_valid
10
+ expect(build(:question_group)).to be_valid
11
11
  end
12
12
  end