quby 4.0.3 → 5.0.0.pre1

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/lib/quby/questionnaires.rb +1 -0
  3. data/lib/quby/questionnaires/api.rb +5 -1
  4. data/lib/quby/questionnaires/deserializer.rb +433 -0
  5. data/lib/quby/questionnaires/dsl.rb +10 -15
  6. data/lib/quby/questionnaires/entities.rb +1 -0
  7. data/lib/quby/questionnaires/entities/charting/line_chart.rb +23 -0
  8. data/lib/quby/questionnaires/entities/charting/overview_chart.rb +3 -1
  9. data/lib/quby/questionnaires/entities/definition.rb +3 -5
  10. data/lib/quby/questionnaires/entities/fields.rb +0 -15
  11. data/lib/quby/questionnaires/entities/question.rb +9 -32
  12. data/lib/quby/questionnaires/entities/questionnaire.rb +4 -15
  13. data/lib/quby/questionnaires/entities/questions/checkbox_question.rb +0 -24
  14. data/lib/quby/questionnaires/entities/questions/date_question.rb +0 -8
  15. data/lib/quby/questionnaires/entities/score_calculation.rb +36 -3
  16. data/lib/quby/questionnaires/repos.rb +1 -0
  17. data/lib/quby/questionnaires/repos/bundle_disk_repo.rb +51 -0
  18. data/lib/quby/version.rb +1 -1
  19. data/spec/internal/log/test-events.log +166 -0
  20. data/spec/internal/log/test.log +6170 -0
  21. data/spec/internal/tmp/capybara/screenshot_2020-10-27-14-25-21.063.html +207 -0
  22. data/spec/internal/tmp/capybara/screenshot_2020-10-27-14-25-21.063.png +0 -0
  23. data/spec/quby/answers/services/answer_validations_spec.rb +8 -8
  24. data/spec/quby/questionnaires/deserializer/questionnaire_spec.rb +237 -0
  25. data/spec/quby/questionnaires/dsl_spec.rb +0 -9
  26. data/spec/quby/questionnaires/entities/fields_spec.rb +3 -3
  27. data/spec/quby/questionnaires/entities/question_spec.rb +0 -8
  28. data/spec/quby/questionnaires/entities/questionnaire_spec.rb +2 -26
  29. data/spec/quby/table_backend/range_tree_spec.rb +7 -0
  30. data/spec/spec_helper.rb +1 -0
  31. metadata +25 -46
  32. data/lib/quby/questionnaires/dsl/base.rb +0 -20
  33. data/lib/quby/questionnaires/dsl/calls_custom_methods.rb +0 -29
  34. data/lib/quby/questionnaires/dsl/charting/bar_chart_builder.rb +0 -18
  35. data/lib/quby/questionnaires/dsl/charting/chart_builder.rb +0 -91
  36. data/lib/quby/questionnaires/dsl/charting/line_chart_builder.rb +0 -57
  37. data/lib/quby/questionnaires/dsl/charting/overview_chart_builder.rb +0 -31
  38. data/lib/quby/questionnaires/dsl/charting/radar_chart_builder.rb +0 -18
  39. data/lib/quby/questionnaires/dsl/helpers.rb +0 -51
  40. data/lib/quby/questionnaires/dsl/panel_builder.rb +0 -80
  41. data/lib/quby/questionnaires/dsl/question_builder.rb +0 -40
  42. data/lib/quby/questionnaires/dsl/questionnaire_builder.rb +0 -252
  43. data/lib/quby/questionnaires/dsl/questions/base.rb +0 -179
  44. data/lib/quby/questionnaires/dsl/questions/checkbox_question_builder.rb +0 -20
  45. data/lib/quby/questionnaires/dsl/questions/date_question_builder.rb +0 -18
  46. data/lib/quby/questionnaires/dsl/questions/deprecated_question_builder.rb +0 -18
  47. data/lib/quby/questionnaires/dsl/questions/float_question_builder.rb +0 -21
  48. data/lib/quby/questionnaires/dsl/questions/integer_question_builder.rb +0 -21
  49. data/lib/quby/questionnaires/dsl/questions/radio_question_builder.rb +0 -20
  50. data/lib/quby/questionnaires/dsl/questions/select_question_builder.rb +0 -18
  51. data/lib/quby/questionnaires/dsl/questions/string_question_builder.rb +0 -20
  52. data/lib/quby/questionnaires/dsl/questions/text_question_builder.rb +0 -22
  53. data/lib/quby/questionnaires/dsl/score_builder.rb +0 -22
  54. data/lib/quby/questionnaires/dsl/standardized_panel_generators.rb +0 -33
  55. data/lib/quby/questionnaires/dsl/table_builder.rb +0 -48
  56. data/lib/quby/questionnaires/services/definition_validator.rb +0 -298
  57. data/spec/quby/questionnaires/dsl/calls_custom_methods_spec.rb +0 -38
  58. data/spec/quby/questionnaires/dsl/charting/bar_chart_builder_spec.rb +0 -41
  59. data/spec/quby/questionnaires/dsl/charting/chart_builder_spec.rb +0 -127
  60. data/spec/quby/questionnaires/dsl/charting/line_chart_builder_spec.rb +0 -66
  61. data/spec/quby/questionnaires/dsl/charting/radar_chart_builder_spec.rb +0 -41
  62. data/spec/quby/questionnaires/dsl/helpers_spec.rb +0 -80
  63. data/spec/quby/questionnaires/dsl/questionnaire_builder_spec.rb +0 -480
  64. data/spec/quby/questionnaires/services/definition_validator_spec.rb +0 -793
  65. data/spec/support/examples_for_chart_builders.rb +0 -59
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
-
5
- shared_examples_for Quby::Questionnaires::DSL::ChartBuilder do
6
- let(:questionnaire) { double(key: 'honos') }
7
-
8
- it 'sets title' do
9
- expect(dsl { title 'Totaalscore' }.title).to eq "Totaalscore"
10
- end
11
-
12
- it 'sets chart type' do
13
- expect(dsl { chart_type :bar }.chart_type).to eq :bar
14
- end
15
-
16
- describe 'setting which scores & answers should be included in the chart' do
17
- let(:tot_score) { Quby::Questionnaires::Entities::ScoreCalculation.new :tot, label: 'Totaal' }
18
- let(:soc_score) { Quby::Questionnaires::Entities::ScoreCalculation.new :soc, label: 'Sociaal' }
19
- let(:float_question) { double(key: :v_1, type: :radio, options: []) }
20
-
21
- let(:plotted_tot_score) do
22
- Quby::Questionnaires::Entities::Charting::Plottable.new(:tot, label: 'Totaal', questionnaire_key: 'honos')
23
- end
24
-
25
- let(:plotted_soc_score) do
26
- Quby::Questionnaires::Entities::Charting::Plottable.new(:soc, label: 'Sociaal', questionnaire_key: 'honos')
27
- end
28
-
29
- let(:plotted_question) do
30
- Quby::Questionnaires::Entities::Charting::Plottable.new(:v_1, label: 'Answer Label', questionnaire_key: 'honos')
31
- end
32
-
33
- before do
34
- allow(questionnaire).to receive(:find_plottable).with(:tot).and_return(tot_score)
35
- allow(questionnaire).to receive(:find_plottable).with(:soc).and_return(soc_score)
36
- allow(questionnaire).to receive(:find_plottable).with('v_1').and_return(float_question)
37
- end
38
-
39
- it 'can be done by passing score keys individually' do
40
- expect(dsl { plot :tot; plot :soc }.plottables).to eq [plotted_tot_score, plotted_soc_score]
41
- end
42
-
43
- it 'can specify which item from the score hash to plot' do
44
- plottable = Quby::Questionnaires::Entities::Charting::Plottable.new(:tot, label: 'Totaal',
45
- plotted_key: :t_score,
46
- questionnaire_key: 'honos')
47
- expect(dsl { plot :tot, plotted_key: :t_score }.plottables).to eq [plottable]
48
- end
49
-
50
- it 'raises when adding score that references unknown scores or questions' do
51
- allow(questionnaire).to receive(:find_plottable).with(:tot).and_return(nil)
52
- expect { dsl { plot :tot } }.to raise_error(/references unknown score/)
53
- end
54
-
55
- it 'can plot answers' do
56
- expect(dsl { plot 'v_1', label: 'Answer Label' }.plottables).to eq [plotted_question]
57
- end
58
- end
59
- end