helena 1.3.1 → 2.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 (66) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +12 -7
  3. data/.travis.yml +11 -0
  4. data/Gemfile +6 -3
  5. data/Gemfile.lock +175 -188
  6. data/README.md +3 -4
  7. data/Rakefile +1 -2
  8. data/app/assets/javascripts/helena/application.js +0 -1
  9. data/app/assets/stylesheets/helena/{application.css.sass → application.scss} +0 -8
  10. data/app/controllers/helena/sessions_controller.rb +7 -1
  11. data/app/helpers/helena/application_helper.rb +18 -0
  12. data/app/models/helena/concerns/questions/validates_one_label.rb +1 -0
  13. data/app/models/helena/question.rb +1 -0
  14. data/app/models/helena/question_group.rb +8 -0
  15. data/app/models/helena/questions/static_text.rb +4 -0
  16. data/app/models/helena/session.rb +1 -19
  17. data/app/models/helena/sub_question.rb +1 -0
  18. data/app/models/helena/version.rb +4 -0
  19. data/app/views/helena/questions/_bipolar_radio_matrix.html.slim +36 -0
  20. data/app/views/helena/questions/{_checkbox_group.html.haml → _checkbox_group.html.slim} +6 -8
  21. data/app/views/helena/questions/_long_text.html.slim +9 -0
  22. data/app/views/helena/questions/{_radio_group.html.haml → _radio_group.html.slim} +5 -6
  23. data/app/views/helena/questions/_radio_matrix.html.slim +27 -0
  24. data/app/views/helena/questions/_short_text.html.slim +9 -0
  25. data/app/views/helena/questions/_static_text.html.slim +2 -4
  26. data/app/views/helena/sessions/_error_messages.html.slim +8 -0
  27. data/app/views/helena/sessions/edit.html.slim +11 -7
  28. data/app/views/helena/sessions/end_message.html.slim +1 -1
  29. data/config/locales/en.yml +13 -12
  30. data/config/locales/views/sessions/en.yml +1 -0
  31. data/gemfiles/rails_4.2.gemfile +18 -15
  32. data/gemfiles/rails_4.2.gemfile.lock +96 -117
  33. data/gemfiles/rails_5.1.gemfile +6 -3
  34. data/gemfiles/rails_5.1.gemfile.lock +127 -146
  35. data/helena.gemspec +16 -20
  36. data/lib/helena.rb +0 -3
  37. data/lib/helena/engine.rb +1 -1
  38. data/lib/helena/survey_importer.rb +4 -1
  39. data/lib/helena/version.rb +1 -1
  40. data/spec/controllers/helena/sessions_controller_spec.rb +2 -2
  41. data/spec/dummy/Rakefile +1 -1
  42. data/spec/dummy/app/views/layouts/{application.html.haml → application.html.slim} +10 -10
  43. data/spec/dummy/bin/bundle +1 -1
  44. data/spec/dummy/bin/rails +1 -1
  45. data/spec/dummy/config/application.rb +1 -2
  46. data/spec/dummy/config/boot.rb +2 -2
  47. data/spec/dummy/config/environment.rb +1 -1
  48. data/spec/factories/helena/surveys.rb +1 -1
  49. data/spec/features/helena/manage_session_spec.rb +40 -36
  50. data/spec/helpers/application_helper_spec.rb +10 -0
  51. data/spec/models/helena/session_spec.rb +1 -8
  52. data/spec/models/helena/sub_question_spec.rb +1 -1
  53. data/spec/spec_helper.rb +3 -1
  54. data/spec/support/rails_compatibility.rb +1 -1
  55. data/test_all_gemfiles.sh +7 -0
  56. metadata +72 -131
  57. data/.coveralls.yml +0 -2
  58. data/Appraisals +0 -12
  59. data/app/assets/stylesheets/helena/forms.css.sass +0 -13
  60. data/app/assets/stylesheets/helena/layout.css.sass +0 -3
  61. data/app/assets/stylesheets/helena/question_groups.css.sass +0 -4
  62. data/app/views/helena/questions/_bipolar_radio_matrix.html.haml +0 -56
  63. data/app/views/helena/questions/_long_text.html.haml +0 -8
  64. data/app/views/helena/questions/_radio_matrix.html.haml +0 -53
  65. data/app/views/helena/questions/_short_text.html.haml +0 -8
  66. data/config/initializers/simple_form_bootstrap.rb +0 -132
@@ -1,4 +1,4 @@
1
- $:.push File.expand_path('../lib', __FILE__)
1
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
2
2
 
3
3
  # Maintain your gem's version:
4
4
  require 'helena/version'
@@ -9,35 +9,31 @@ Gem::Specification.new do |s|
9
9
  s.version = Helena::VERSION
10
10
  s.authors = ['Markus Graf']
11
11
  s.email = ['info@markusgraf.ch']
12
- s.licenses = ['GPL-3']
12
+ s.licenses = ['GPL-3.0+']
13
13
  s.homepage = 'https://github.com/gurix/helena'
14
14
  s.summary = 'Helena is an online survey/test framework designed for agile
15
15
  survey/test development, longitudinal studies and instant feedback.'
16
16
  s.description = 'Helena is an online survey/test framework designed for agile
17
17
  survey/test development, longitudinal studies and instant feedback.'
18
18
 
19
- s.files = `git ls-files`.split("\n")
20
- s.test_files = `git ls-files -- {spec}/*`.split("\n")
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {spec}/*`.split("\n")
21
21
 
22
- s.add_dependency 'rails', '>= 4.2'
23
22
  s.add_dependency 'mongoid', '>= 4.0'
24
- s.add_dependency 'mongoid_orderable', '~> 4.1'
25
23
  s.add_dependency 'mongoid-simple-tags', '>= 0.1.3'
26
- s.add_dependency 'haml-rails', '~> 1.0'
27
- s.add_dependency 'slim', '~> 3.0'
28
- s.add_dependency 'jquery-rails', '~> 4.0'
29
- s.add_dependency 'sass-rails', '~> 5.0'
30
- s.add_dependency 'bootstrap-sass', '~> 3.2'
31
- s.add_dependency 'simple_form', '~> 3.2'
24
+ s.add_dependency 'mongoid-tree', '>= 2.0'
25
+ s.add_dependency 'mongoid_orderable', '>= 5.2'
26
+ s.add_dependency 'rails', '>= 4.2'
32
27
  s.add_dependency 'rails-i18n', '>= 4.0'
33
- s.add_dependency 'responders', '~> 2.0'
34
- s.add_dependency 'browser', '~> 2.0'
35
- s.add_dependency 'mongoid-tree', '~> 2.0'
28
+ s.add_dependency 'responders', '>= 2.0'
29
+ s.add_dependency 'sass-rails', '>= 5.0'
30
+ s.add_dependency 'simple_form', '>= 4'
31
+ s.add_dependency 'slim', '>= 3.0'
36
32
 
37
- s.add_development_dependency 'rspec-rails', '~> 3'
38
- s.add_development_dependency 'rspec-collection_matchers', '~> 1'
33
+ s.add_development_dependency 'appraisal'
34
+ s.add_development_dependency 'capybara', '>= 2.3'
39
35
  s.add_development_dependency 'factory_bot_rails'
40
- s.add_development_dependency 'faker', '~> 1.4'
41
- s.add_development_dependency 'capybara', '~> 2.3'
42
- s.add_development_dependency "appraisal"
36
+ s.add_development_dependency 'faker', '>= 1.4'
37
+ s.add_development_dependency 'rspec-collection_matchers', '>= 1'
38
+ s.add_development_dependency 'rspec-rails', '>= 3'
43
39
  end
@@ -1,14 +1,11 @@
1
1
  require 'helena/engine'
2
- require 'haml'
3
2
  require 'helena/version_publisher'
4
3
  require 'helena/survey_importer'
5
4
  require 'mongoid'
6
- require 'simple_form' # TODO: Remove this when amdin interface is finally moved
7
5
  require 'mongoid_orderable'
8
6
  require 'mongoid-simple-tags'
9
7
  require 'slim'
10
8
  require 'mongoid/tree'
11
- require 'browser'
12
9
 
13
10
  module Helena
14
11
  end
@@ -5,7 +5,7 @@ module Helena
5
5
 
6
6
  # Thanks to https://github.com/thoughtbot/factory_girl_rails/pull/42
7
7
  initializer 'helena.factories', after: 'factory_bot.set_factory_paths' do
8
- FactoryBot.definition_file_paths << File.expand_path('../../../spec/factories/helena', __FILE__) if defined?(FactoryBot)
8
+ FactoryBot.definition_file_paths << File.expand_path('../../spec/factories/helena', __dir__) 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
@@ -16,6 +16,7 @@ module Helena
16
16
  @survey = Helena::Survey.find_or_initialize_by @parsed.except('versions')
17
17
  return unless @survey.save!
18
18
  return unless @parsed['versions']
19
+
19
20
  @parsed['versions'].each { |parsed_version| create_version parsed_version }
20
21
  end
21
22
 
@@ -24,6 +25,7 @@ module Helena
24
25
  return unless version.new_record? # We ignore already imported versions
25
26
  return unless version.save!
26
27
  return unless parsed_version.last['question_groups']
28
+
27
29
  parsed_version.last['question_groups'].each { |parsed_question_group| create_question_group version, parsed_question_group }
28
30
  end
29
31
 
@@ -32,6 +34,7 @@ module Helena
32
34
  question_group.position = parsed_question_group.first
33
35
  return unless question_group.save!
34
36
  return unless parsed_question_group.last['questions']
37
+
35
38
  parsed_question_group.last['questions'].each { |parsed_question| create_question question_group, parsed_question }
36
39
  end
37
40
 
@@ -1,3 +1,3 @@
1
1
  module Helena
2
- VERSION = '1.3.1'.freeze
2
+ VERSION = '2.0.0'.freeze
3
3
  end
@@ -15,8 +15,8 @@ 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, parametrize(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
 
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require File.expand_path('config/application', __dir__)
5
5
 
6
6
  Dummy::Application.load_tasks
@@ -1,22 +1,22 @@
1
- !!!
2
- %html
3
- %head
4
- %title Helena
1
+ doctype html
2
+ html
3
+ head
4
+ title = "#{content_for(:title)} - #{t('.brand_name')}"
5
+
5
6
  = stylesheet_link_tag 'helena/application', media: 'all'
6
7
  = javascript_include_tag 'helena/application'
7
- %meta{ name: 'viewport', content: 'initial-scale=1.0' }
8
8
  = csrf_meta_tags
9
9
 
10
- %body
10
+ body
11
11
  .container
12
12
  - flash.each do |name, messages|
13
- %div{class: "alert alert-#{name == 'notice' ? 'success' : 'danger'}"}
13
+ div class="alert alert-#{name}"
14
14
  - if messages.is_a?(String)
15
15
  = messages
16
16
  - else
17
- %ul
17
+ ul
18
18
  - messages.each do |message|
19
- %li= message
20
- %h1.hidden
19
+ li= message
20
+ h1
21
21
  Helena
22
22
  = yield
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
@@ -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', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -1,11 +1,10 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require File.expand_path('boot', __dir__)
2
2
 
3
3
  # Pick the frameworks you want:
4
4
  require 'action_controller/railtie'
5
5
  require 'action_mailer/railtie'
6
6
  require 'sprockets/railtie'
7
7
  require 'rails/mongoid'
8
- require 'browser'
9
8
 
10
9
  Bundler.require(*Rails.groups)
11
10
  require 'helena'
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
3
 
4
4
  require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
5
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require File.expand_path('application', __dir__)
3
3
 
4
4
  # Initialize the Rails application.
5
5
  Dummy::Application.initialize!
@@ -1,6 +1,6 @@
1
1
  FactoryBot.define do
2
2
  factory :survey, class: Helena::Survey do
3
3
  sequence(:name) { |n| "Survey #{n}" }
4
- language 'en'
4
+ language { 'en' }
5
5
  end
6
6
  end
@@ -18,20 +18,20 @@ feature 'Session management' do
18
18
 
19
19
  second_question_group = base_version.question_groups.create title: 'Question Group 2', allow_to_go_back: true
20
20
 
21
- all_and_everything = build :radio_group_question, code: :all_and_everything,
22
- question_text: 'What is the answer to the Ultimate Question of Life, the Universe, and Everything?',
23
- position: 1
21
+ all_and_everything = build :radio_group_question, code: :all_and_everything,
22
+ question_text: 'What is the answer to the Ultimate Question of Life, the Universe, and Everything?',
23
+ position: 1
24
24
 
25
25
  all_and_everything.labels << build(:label, position: 1, text: 'Just Chuck Norris knows it', value: 'norris')
26
26
  all_and_everything.labels << build(:label, position: 2, text: 'God', value: 'god')
27
27
  all_and_everything.labels << build(:label, position: 3, text: '42', value: 42)
28
- all_and_everything.labels << build(:label, position: 4, text: 'Your mom', value: 'mom', preselected: :true)
28
+ all_and_everything.labels << build(:label, position: 4, text: 'Your mom', value: 'mom', preselected: true)
29
29
 
30
30
  second_question_group.questions << all_and_everything
31
31
 
32
- food_allergy = build :checkbox_group_question, code: :food_allergy,
33
- question_text: 'What kind of food allergy do you have?',
34
- position: 2
32
+ food_allergy = build :checkbox_group_question, code: :food_allergy,
33
+ question_text: 'What kind of food allergy do you have?',
34
+ position: 2
35
35
 
36
36
  food_allergy.sub_questions << build(:sub_question, text: 'Garlic', code: 'garlic', position: 1, preselected: true)
37
37
  food_allergy.sub_questions << build(:sub_question, text: 'Oats', code: 'oat', position: 2)
@@ -41,10 +41,10 @@ feature 'Session management' do
41
41
 
42
42
  third_question_group = base_version.question_groups.create title: 'Question Group 3', allow_to_go_back: true
43
43
 
44
- satisfaction_matrix = build :radio_matrix_question, code: :satisfaction,
44
+ satisfaction_matrix = build :radio_matrix_question, code: :satisfaction,
45
45
  question_text: 'Below are five statements with which you may agree or disagree.',
46
- required: true,
47
- position: 1
46
+ required: true,
47
+ position: 1
48
48
 
49
49
  satisfaction_matrix.labels << build(:label, position: 1, text: 'Strongly Disagree', value: 1)
50
50
  satisfaction_matrix.labels << build(:label, position: 2, text: 'Disagree', value: 2)
@@ -57,8 +57,8 @@ feature 'Session management' do
57
57
  satisfaction_matrix.sub_questions << build(:sub_question, text: 'In most ways my life is close to my ideal.', code: 'life_is_ideal', position: 1)
58
58
  satisfaction_matrix.sub_questions << build(:sub_question, text: 'The conditions of my life are excellent.', code: 'condition', position: 2)
59
59
  satisfaction_matrix.sub_questions << build(:sub_question, text: 'I am satisfied with life.', code: 'satisfied_with_life', position: 3)
60
- satisfaction_matrix.sub_questions << build(:sub_question, text: 'So far I have gotten the important things I want in life.',
61
- code: 'important_things',
60
+ satisfaction_matrix.sub_questions << build(:sub_question, text: 'So far I have gotten the important things I want in life.',
61
+ code: 'important_things',
62
62
  position: 4)
63
63
  satisfaction_matrix.sub_questions << build(:sub_question, text: 'If I could live my life over, I would change almost nothing.',
64
64
  code: 'nothing_to_change',
@@ -84,8 +84,9 @@ feature 'Session management' do
84
84
 
85
85
  expect(page).not_to have_link 'Back'
86
86
 
87
- fill_in 'session_answers_a_name', with: 'Hans'
88
- fill_in 'session_answers_selfdescription', with: 'I am a proud man living in middle earth. Everybody is laughing at me because I do not have hairy feets.'
87
+ fill_in "What's your name?", with: 'Hans'
88
+
89
+ fill_in 'Give a brief description of yourself', with: 'I am a proud man living in middle earth.'
89
90
 
90
91
  expect { click_button 'Next' }.to change { session.reload.answers.count }.from(0).to(2)
91
92
  expect(session.reload.last_question_group_id).to eq second_question_group.id
@@ -174,9 +175,12 @@ feature 'Session management' do
174
175
 
175
176
  visit helena.edit_session_path(session.token)
176
177
 
177
- expect(page).to have_content "What's your name? *"
178
+ expect(page).to have_content "What's your name?*"
178
179
  expect(page).to have_content '* indicates required fields'
179
- expect { click_button 'Save' }.not_to change { session.reload.answers.count }
180
+ expect { click_button 'Save' }.not_to(change { session.reload.answers.count })
181
+ expect(page).to have_content('One or more questions have not been answered correctly.')
182
+ expect(page).to have_content("«What's your name?» can't be blank.")
183
+
180
184
  expect(page).to have_content("can't be blank")
181
185
  end
182
186
 
@@ -200,15 +204,15 @@ feature 'Session management' do
200
204
 
201
205
  visit helena.edit_session_path(session.token)
202
206
 
203
- expect(page).to have_content 'Give a brief description of yourself *'
204
- expect { click_button 'Save' }.not_to change { session.reload.answers.count }
207
+ expect(page).to have_content 'Give a brief description of yourself*'
208
+ expect { click_button 'Save' }.not_to(change { session.reload.answers.count })
205
209
  expect(page).to have_content("can't be blank")
206
210
  end
207
211
 
208
212
  scenario 'does not save a non selected radio group when required' do
209
- all_and_everything = build :radio_group_question, code: :all_and_everything,
210
- question_text: 'What is the answer to the Ultimate Question of Life, the Universe, and Everything?',
211
- required: true
213
+ all_and_everything = build :radio_group_question, code: :all_and_everything,
214
+ question_text: 'What is the answer to the Ultimate Question of Life, the Universe, and Everything?',
215
+ required: true
212
216
 
213
217
  all_and_everything.labels << build(:label, value: 'norris')
214
218
  all_and_everything.labels << build(:label, value: 'god')
@@ -221,16 +225,16 @@ feature 'Session management' do
221
225
 
222
226
  visit helena.edit_session_path(session.token)
223
227
 
224
- expect(page).to have_content 'What is the answer to the Ultimate Question of Life, the Universe, and Everything? *'
225
- expect { click_button 'Save' }.not_to change { session.reload.answers.count }
228
+ expect(page).to have_content 'What is the answer to the Ultimate Question of Life, the Universe, and Everything?*'
229
+ expect { click_button 'Save' }.not_to(change { session.reload.answers.count })
226
230
 
227
231
  expect(page).to have_content("can't be blank")
228
232
  end
229
233
 
230
234
  scenario 'does not save when no subquestion of a checkbox group is selected if required' do
231
- food_allergy = build :checkbox_group_question, code: :food_allergy,
232
- question_text: 'What kind of food allergy do you have?',
233
- required: true
235
+ food_allergy = build :checkbox_group_question, code: :food_allergy,
236
+ question_text: 'What kind of food allergy do you have?',
237
+ required: true
234
238
 
235
239
  food_allergy.sub_questions << build(:sub_question, text: 'Garlic', code: 'garlic')
236
240
  food_allergy.sub_questions << build(:sub_question, text: 'Oats', code: 'oat')
@@ -242,15 +246,15 @@ feature 'Session management' do
242
246
 
243
247
  visit helena.edit_session_path(session.token)
244
248
 
245
- expect(page).to have_content 'What kind of food allergy do you have? *'
249
+ expect(page).to have_content 'What kind of food allergy do you have?*'
246
250
  expect { click_button 'Save' }.to change { session.reload.answers.map(&:value) }.from([]).to([0, 0, 0])
247
251
  expect(page).to have_content("can't be blank")
248
252
  end
249
253
 
250
254
  scenario 'saves when subquestion of a checkbox group is selected if required' do
251
- food_allergy = build :checkbox_group_question, code: :food_allergy,
252
- question_text: 'What kind of food allergy do you have?',
253
- required: true
255
+ food_allergy = build :checkbox_group_question, code: :food_allergy,
256
+ question_text: 'What kind of food allergy do you have?',
257
+ required: true
254
258
 
255
259
  food_allergy.sub_questions << build(:sub_question, text: 'Garlic', code: 'garlic')
256
260
  food_allergy.sub_questions << build(:sub_question, text: 'Oats', code: 'oat')
@@ -262,16 +266,16 @@ feature 'Session management' do
262
266
 
263
267
  visit helena.edit_session_path(session.token)
264
268
 
265
- expect(page).to have_content 'What kind of food allergy do you have? *'
269
+ expect(page).to have_content 'What kind of food allergy do you have?*'
266
270
  check('Oats')
267
271
  expect { click_button 'Save' }.to change { session.reload.answers.count }.from(0).to(3)
268
272
  expect(page).not_to have_content("can't be blank")
269
273
  end
270
274
 
271
275
  scenario 'does not save when radio matrix is filled out completely if required' do
272
- satisfaction_matrix = build :radio_matrix_question, code: :satisfaction,
276
+ satisfaction_matrix = build :radio_matrix_question, code: :satisfaction,
273
277
  question_text: 'Below are five statements with which you may agree or disagree.',
274
- required: true
278
+ required: true
275
279
 
276
280
  satisfaction_matrix.labels << build(:label, value: 1)
277
281
  satisfaction_matrix.labels << build(:label, value: 2)
@@ -293,7 +297,7 @@ feature 'Session management' do
293
297
 
294
298
  visit helena.edit_session_path(session.token)
295
299
 
296
- expect(page).to have_content 'Below are five statements with which you may agree or disagree. *'
300
+ expect(page).to have_content 'Below are five statements with which you may agree or disagree.*'
297
301
 
298
302
  choose('session_answers_satisfied_with_life_3')
299
303
 
@@ -303,7 +307,7 @@ feature 'Session management' do
303
307
  end
304
308
 
305
309
  scenario 'Displaying a bipolar radio matrix question"' do
306
- radio_matrix = build :bipolar_radio_matrix_question, code: :satisfaction,
310
+ radio_matrix = build :bipolar_radio_matrix_question, code: :satisfaction,
307
311
  question_text: 'What do you like more?'
308
312
 
309
313
  radio_matrix.labels << build(:label, value: 1, text: 'Yo')
@@ -321,7 +325,7 @@ feature 'Session management' do
321
325
 
322
326
  visit helena.edit_session_path(session.token)
323
327
 
324
- expect(page.all('table thead tr th').size).to eq 5
328
+ expect(page.all('table thead tr th').size).to eq 3
325
329
  expect(page.find('table tbody tr:first td:first')).to have_content 'Ice cream'
326
330
  expect(page.find('table tbody tr:last td:first')).to have_content 'I am not splitted'
327
331
  expect(page.find('table tbody tr:last td:last').text).to be_empty
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Helena::ApplicationHelper do
4
+ describe '.title' do
5
+ it 'sets content for :title' do
6
+ helper.title 'test'
7
+ expect(view.content_for(:title)).to eq 'test'
8
+ end
9
+ end
10
+ end
@@ -43,20 +43,13 @@ describe Helena::Session do
43
43
  end.to change { session.answers.find_by(code: 'a').value }.from(42).to(666)
44
44
  end
45
45
 
46
- it 'does not affect the answer when the value is the same' do
47
- expect do
48
- session.answers_as_yaml = 'a: 42'
49
- session.save
50
- end.not_to change { session.answers.find_by code: 'a' }
51
- end
52
-
53
46
  it 'removes existings answers that is not in the yaml' do
54
47
  expect do
55
48
  session.answers_as_yaml = 'x: "test"'
56
49
  session.save
57
50
  end.to change { session.reload.answers.size }.by(-2)
58
51
 
59
- expect(session.answers.in(code: %w(a b c)).size).to eq 0
52
+ expect(session.answers.in(code: %w[a b c]).size).to eq 0
60
53
  end
61
54
  end
62
55
  end
@@ -40,7 +40,7 @@ describe Helena::SubQuestion do
40
40
  it 'returns correct parts' do
41
41
  splitted_sub_question = build :sub_question, question: question, text: 'first|last'
42
42
 
43
- expect(splitted_sub_question.parts).to eq %w(first last)
43
+ expect(splitted_sub_question.parts).to eq %w[first last]
44
44
  end
45
45
  end
46
46
  end