decidim-forms 0.31.5 → 0.32.0.rc1
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.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/app/commands/decidim/forms/response_questionnaire.rb +1 -1
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +5 -12
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_responses.rb +1 -1
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +1 -1
- data/app/models/decidim/forms/response.rb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/responses/index.html.erb +3 -1
- data/app/views/decidim/forms/admin/questionnaires/responses/show.html.erb +3 -1
- data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/show.html.erb +1 -1
- data/config/locales/ar.yml +0 -4
- data/config/locales/bg.yml +0 -4
- data/config/locales/ca-IT.yml +5 -5
- data/config/locales/ca.yml +5 -5
- data/config/locales/cs.yml +3 -4
- data/config/locales/de.yml +2 -4
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +3 -2
- data/config/locales/es-MX.yml +4 -4
- data/config/locales/es-PY.yml +4 -4
- data/config/locales/es.yml +3 -3
- data/config/locales/eu.yml +3 -3
- data/config/locales/fi-plain.yml +4 -4
- data/config/locales/fi.yml +3 -3
- data/config/locales/fr-CA.yml +4 -4
- data/config/locales/fr.yml +4 -4
- data/config/locales/ga-IE.yml +0 -1
- data/config/locales/gl.yml +0 -4
- data/config/locales/hu.yml +0 -4
- data/config/locales/id-ID.yml +0 -4
- data/config/locales/it.yml +0 -4
- data/config/locales/ja.yml +3 -3
- data/config/locales/kaa.yml +0 -1
- data/config/locales/lb.yml +0 -4
- data/config/locales/lt.yml +0 -4
- data/config/locales/lv.yml +0 -4
- data/config/locales/nl.yml +0 -4
- data/config/locales/no.yml +0 -4
- data/config/locales/pl.yml +0 -4
- data/config/locales/pt-BR.yml +3 -4
- data/config/locales/pt.yml +0 -4
- data/config/locales/ro-RO.yml +0 -4
- data/config/locales/ru.yml +0 -4
- data/config/locales/sk.yml +0 -186
- data/config/locales/sv.yml +3 -3
- data/config/locales/tr-TR.yml +0 -4
- data/config/locales/val-ES.yml +0 -1
- data/config/locales/zh-CN.yml +0 -4
- data/config/locales/zh-TW.yml +0 -4
- data/decidim-forms.gemspec +6 -8
- data/lib/decidim/api/questionnaire_entity_interface.rb +1 -0
- data/lib/decidim/forms/download_your_data_user_responses_serializer.rb +1 -0
- data/lib/decidim/forms/test/factories.rb +9 -5
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +23 -23
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +1 -1
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +4 -4
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +1 -1
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +9 -9
- data/lib/decidim/forms/version.rb +1 -1
- metadata +10 -15
- data/lib/decidim/forms/test/shared_examples/questionnaire_admin_access.rb +0 -95
- data/lib/decidim/forms/test/shared_examples/questionnaire_admin_controller_permissions.rb +0 -41
|
@@ -53,7 +53,7 @@ shared_examples_for "has questionnaire" do
|
|
|
53
53
|
click_on "Submit"
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
expect(page).to
|
|
56
|
+
expect(page).to have_callout(callout_success)
|
|
57
57
|
|
|
58
58
|
visit questionnaire_public_path
|
|
59
59
|
see_questionnaire_questions
|
|
@@ -125,7 +125,7 @@ shared_examples_for "has questionnaire" do
|
|
|
125
125
|
check "questionnaire_tos_agreement"
|
|
126
126
|
accept_confirm { click_on "Submit" }
|
|
127
127
|
|
|
128
|
-
expect(page).to
|
|
128
|
+
expect(page).to have_callout(callout_success)
|
|
129
129
|
|
|
130
130
|
visit questionnaire_public_path
|
|
131
131
|
see_questionnaire_questions
|
|
@@ -269,7 +269,7 @@ shared_examples_for "has questionnaire" do
|
|
|
269
269
|
end
|
|
270
270
|
|
|
271
271
|
it "submits the form and shows errors" do
|
|
272
|
-
expect(page).to
|
|
272
|
+
expect(page).to have_callout(callout_failure)
|
|
273
273
|
expect(page).to have_content("cannot be blank")
|
|
274
274
|
end
|
|
275
275
|
end
|
|
@@ -283,7 +283,7 @@ shared_examples_for "has questionnaire" do
|
|
|
283
283
|
|
|
284
284
|
it "submits the form and shows errors" do
|
|
285
285
|
expect(page).to have_css ".alert.flash"
|
|
286
|
-
expect(page).to
|
|
286
|
+
expect(page).to have_callout(callout_failure)
|
|
287
287
|
different_error = I18n.t("decidim.forms.questionnaires.response.max_choices_alert")
|
|
288
288
|
expect(different_error).to eq("There are too many choices selected")
|
|
289
289
|
expect(page).to have_no_content(different_error)
|
|
@@ -317,7 +317,7 @@ shared_examples_for "has questionnaire" do
|
|
|
317
317
|
end
|
|
318
318
|
|
|
319
319
|
it "submits the form and shows errors" do
|
|
320
|
-
expect(page).to
|
|
320
|
+
expect(page).to have_callout(callout_failure)
|
|
321
321
|
expect(page).to have_content("cannot be blank")
|
|
322
322
|
end
|
|
323
323
|
end
|
|
@@ -391,7 +391,7 @@ shared_examples_for "has questionnaire" do
|
|
|
391
391
|
check "questionnaire_tos_agreement"
|
|
392
392
|
accept_confirm { click_on "Submit" }
|
|
393
393
|
|
|
394
|
-
expect(page).to
|
|
394
|
+
expect(page).to have_callout(callout_success)
|
|
395
395
|
expect(Decidim::Forms::Response.first.choices.first.custom_body).to eq("Cacatua")
|
|
396
396
|
end
|
|
397
397
|
|
|
@@ -406,7 +406,7 @@ shared_examples_for "has questionnaire" do
|
|
|
406
406
|
check "questionnaire_tos_agreement"
|
|
407
407
|
accept_confirm { click_on "Submit" }
|
|
408
408
|
|
|
409
|
-
expect(page).to
|
|
409
|
+
expect(page).to have_callout("There was a problem responding")
|
|
410
410
|
expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
|
|
411
411
|
end
|
|
412
412
|
|
|
@@ -433,7 +433,7 @@ shared_examples_for "has questionnaire" do
|
|
|
433
433
|
check "questionnaire_tos_agreement"
|
|
434
434
|
accept_confirm { click_on "Submit" }
|
|
435
435
|
|
|
436
|
-
expect(page).to
|
|
436
|
+
expect(page).to have_callout(callout_success)
|
|
437
437
|
expect(Decidim::Forms::Response.first.choices.first.custom_body).to eq("Cacatua")
|
|
438
438
|
end
|
|
439
439
|
|
|
@@ -448,7 +448,7 @@ shared_examples_for "has questionnaire" do
|
|
|
448
448
|
check "questionnaire_tos_agreement"
|
|
449
449
|
accept_confirm { click_on "Submit" }
|
|
450
450
|
|
|
451
|
-
expect(page).to
|
|
451
|
+
expect(page).to have_callout("There was a problem responding")
|
|
452
452
|
expect(page).to have_field("questionnaire_responses_0_choices_2_custom_body", with: "Cacatua")
|
|
453
453
|
end
|
|
454
454
|
|
|
@@ -500,7 +500,7 @@ shared_examples_for "has questionnaire" do
|
|
|
500
500
|
|
|
501
501
|
accept_confirm { click_on "Submit" }
|
|
502
502
|
|
|
503
|
-
expect(page).to
|
|
503
|
+
expect(page).to have_callout(callout_success)
|
|
504
504
|
|
|
505
505
|
visit questionnaire_public_path
|
|
506
506
|
see_questionnaire_questions
|
|
@@ -529,7 +529,7 @@ shared_examples_for "has questionnaire" do
|
|
|
529
529
|
|
|
530
530
|
accept_confirm { click_on "Submit" }
|
|
531
531
|
|
|
532
|
-
expect(page).to
|
|
532
|
+
expect(page).to have_callout(callout_success)
|
|
533
533
|
|
|
534
534
|
visit questionnaire_public_path
|
|
535
535
|
see_questionnaire_questions
|
|
@@ -556,14 +556,14 @@ shared_examples_for "has questionnaire" do
|
|
|
556
556
|
|
|
557
557
|
accept_confirm { click_on "Submit" }
|
|
558
558
|
|
|
559
|
-
expect(page).to
|
|
559
|
+
expect(page).to have_callout("There was a problem responding")
|
|
560
560
|
expect(page).to have_content("are too many")
|
|
561
561
|
|
|
562
562
|
uncheck response_options[2]["body"][:en]
|
|
563
563
|
|
|
564
564
|
accept_confirm { click_on "Submit" }
|
|
565
565
|
|
|
566
|
-
expect(page).to
|
|
566
|
+
expect(page).to have_callout(callout_success)
|
|
567
567
|
end
|
|
568
568
|
end
|
|
569
569
|
|
|
@@ -606,7 +606,7 @@ shared_examples_for "has questionnaire" do
|
|
|
606
606
|
|
|
607
607
|
accept_confirm { click_on "Submit" }
|
|
608
608
|
|
|
609
|
-
expect(page).to
|
|
609
|
+
expect(page).to have_callout(callout_success)
|
|
610
610
|
expect(Decidim::Forms::Response.first.choices.pluck(:position, :body)).to eq(
|
|
611
611
|
[[0, "We"], [1, "all"], [2, "like"], [3, "dark"], [4, "chocolate"]]
|
|
612
612
|
)
|
|
@@ -647,7 +647,7 @@ shared_examples_for "has questionnaire" do
|
|
|
647
647
|
|
|
648
648
|
accept_confirm { click_on "Submit" }
|
|
649
649
|
|
|
650
|
-
expect(page).to
|
|
650
|
+
expect(page).to have_callout(callout_success)
|
|
651
651
|
|
|
652
652
|
visit questionnaire_public_path
|
|
653
653
|
see_questionnaire_questions
|
|
@@ -670,7 +670,7 @@ shared_examples_for "has questionnaire" do
|
|
|
670
670
|
|
|
671
671
|
accept_confirm { click_on "Submit" }
|
|
672
672
|
|
|
673
|
-
expect(page).to
|
|
673
|
+
expect(page).to have_callout("There was a problem responding")
|
|
674
674
|
|
|
675
675
|
radio_buttons = page.all(".js-radio-button-collection input[type=radio]")
|
|
676
676
|
expect(radio_buttons.pluck(:checked)).to eq([nil, "true", nil, nil])
|
|
@@ -689,7 +689,7 @@ shared_examples_for "has questionnaire" do
|
|
|
689
689
|
check "questionnaire_tos_agreement"
|
|
690
690
|
accept_confirm { click_on "Submit" }
|
|
691
691
|
|
|
692
|
-
expect(page).to
|
|
692
|
+
expect(page).to have_callout("There was a problem responding")
|
|
693
693
|
expect(page).to have_content("Choices are not complete")
|
|
694
694
|
end
|
|
695
695
|
end
|
|
@@ -732,7 +732,7 @@ shared_examples_for "has questionnaire" do
|
|
|
732
732
|
|
|
733
733
|
accept_confirm { click_on "Submit" }
|
|
734
734
|
|
|
735
|
-
expect(page).to
|
|
735
|
+
expect(page).to have_callout(callout_success)
|
|
736
736
|
|
|
737
737
|
visit questionnaire_public_path
|
|
738
738
|
see_questionnaire_questions
|
|
@@ -779,7 +779,7 @@ shared_examples_for "has questionnaire" do
|
|
|
779
779
|
|
|
780
780
|
accept_confirm { click_on "Submit" }
|
|
781
781
|
|
|
782
|
-
expect(page).to
|
|
782
|
+
expect(page).to have_callout("There was a problem responding")
|
|
783
783
|
expect(page).to have_content("are too many")
|
|
784
784
|
|
|
785
785
|
checkboxes = page.all(".js-check-box-collection input[type=checkbox]")
|
|
@@ -788,7 +788,7 @@ shared_examples_for "has questionnaire" do
|
|
|
788
788
|
|
|
789
789
|
accept_confirm { click_on "Submit" }
|
|
790
790
|
|
|
791
|
-
expect(page).to
|
|
791
|
+
expect(page).to have_callout(callout_success)
|
|
792
792
|
end
|
|
793
793
|
end
|
|
794
794
|
|
|
@@ -805,7 +805,7 @@ shared_examples_for "has questionnaire" do
|
|
|
805
805
|
check "questionnaire_tos_agreement"
|
|
806
806
|
accept_confirm { click_on "Submit" }
|
|
807
807
|
|
|
808
|
-
expect(page).to
|
|
808
|
+
expect(page).to have_callout("There was a problem responding")
|
|
809
809
|
expect(page).to have_content("Choices are not complete")
|
|
810
810
|
end
|
|
811
811
|
end
|
|
@@ -826,7 +826,7 @@ shared_examples_for "has questionnaire" do
|
|
|
826
826
|
check "questionnaire_tos_agreement"
|
|
827
827
|
accept_confirm { click_on "Submit" }
|
|
828
828
|
|
|
829
|
-
expect(page).to
|
|
829
|
+
expect(page).to have_callout("There was a problem responding")
|
|
830
830
|
|
|
831
831
|
checkboxes = page.all(".js-check-box-collection input[type=checkbox]")
|
|
832
832
|
expect(checkboxes.pluck(:checked)).to eq(["true", "true", "true", nil, nil, "true"])
|
|
@@ -1373,7 +1373,7 @@ shared_examples_for "has questionnaire" do
|
|
|
1373
1373
|
|
|
1374
1374
|
accept_confirm { click_on "Submit" }
|
|
1375
1375
|
|
|
1376
|
-
expect(page).to
|
|
1376
|
+
expect(page).to have_callout(callout_success)
|
|
1377
1377
|
end
|
|
1378
1378
|
end
|
|
1379
1379
|
end
|
|
@@ -54,7 +54,7 @@ shared_examples_for "add questions" do
|
|
|
54
54
|
|
|
55
55
|
click_on "Save"
|
|
56
56
|
|
|
57
|
-
expect(page).to
|
|
57
|
+
expect(page).to have_callout(callout_success)
|
|
58
58
|
|
|
59
59
|
visit_manage_questions_and_expand_all
|
|
60
60
|
|
|
@@ -76,7 +76,7 @@ shared_examples_for "add questions" do
|
|
|
76
76
|
|
|
77
77
|
click_on "Save"
|
|
78
78
|
|
|
79
|
-
expect(page).to
|
|
79
|
+
expect(page).to have_callout(callout_success)
|
|
80
80
|
|
|
81
81
|
update_component_settings_or_attributes
|
|
82
82
|
|
|
@@ -98,7 +98,7 @@ shared_examples_for "add questions" do
|
|
|
98
98
|
|
|
99
99
|
click_on "Save"
|
|
100
100
|
|
|
101
|
-
expect(page).to
|
|
101
|
+
expect(page).to have_callout(callout_success)
|
|
102
102
|
|
|
103
103
|
update_component_settings_or_attributes
|
|
104
104
|
|
|
@@ -152,7 +152,7 @@ shared_examples_for "add questions" do
|
|
|
152
152
|
|
|
153
153
|
click_on "Save"
|
|
154
154
|
|
|
155
|
-
expect(page).to
|
|
155
|
+
expect(page).to have_callout(callout_success)
|
|
156
156
|
|
|
157
157
|
visit_manage_questions_and_expand_all
|
|
158
158
|
|
|
@@ -21,7 +21,7 @@ shared_examples_for "update questions" do
|
|
|
21
21
|
|
|
22
22
|
click_on "Save"
|
|
23
23
|
|
|
24
|
-
expect(page).to
|
|
24
|
+
expect(page).to have_callout(callout_success)
|
|
25
25
|
|
|
26
26
|
visit_manage_questions_and_expand_all
|
|
27
27
|
|
|
@@ -47,7 +47,7 @@ shared_examples_for "update questions" do
|
|
|
47
47
|
click_on "Save"
|
|
48
48
|
click_on "Expand all questions"
|
|
49
49
|
|
|
50
|
-
expect(page).to
|
|
50
|
+
expect(page).to have_callout(callout_failure)
|
|
51
51
|
expect(page).to have_content("cannot be blank", count: 5)
|
|
52
52
|
expect(page).to have_content("must be greater than or equal to 0", count: 1)
|
|
53
53
|
|
|
@@ -83,7 +83,7 @@ shared_examples_for "update questions" do
|
|
|
83
83
|
|
|
84
84
|
click_on "Save"
|
|
85
85
|
|
|
86
|
-
expect(page).to
|
|
86
|
+
expect(page).to have_callout(callout_success)
|
|
87
87
|
|
|
88
88
|
click_on "Questions"
|
|
89
89
|
|
|
@@ -118,7 +118,7 @@ shared_examples_for "update questions" do
|
|
|
118
118
|
|
|
119
119
|
click_on "Save"
|
|
120
120
|
|
|
121
|
-
expect(page).to
|
|
121
|
+
expect(page).to have_callout(callout_success)
|
|
122
122
|
|
|
123
123
|
visit_manage_questions_and_expand_all
|
|
124
124
|
|
|
@@ -137,7 +137,7 @@ shared_examples_for "update questions" do
|
|
|
137
137
|
|
|
138
138
|
expand_all_questions
|
|
139
139
|
|
|
140
|
-
expect(page).to
|
|
140
|
+
expect(page).to have_callout(callout_failure)
|
|
141
141
|
expect(page).to have_content("cannot be blank", count: 1)
|
|
142
142
|
expect(page).to have_css("input[value='']")
|
|
143
143
|
expect(page).to have_no_css("input[value='This is the first title and description']")
|
|
@@ -167,7 +167,7 @@ shared_examples_for "update questions" do
|
|
|
167
167
|
|
|
168
168
|
click_on "Save"
|
|
169
169
|
|
|
170
|
-
expect(page).to
|
|
170
|
+
expect(page).to have_callout(callout_success)
|
|
171
171
|
|
|
172
172
|
click_on "Questions"
|
|
173
173
|
|
|
@@ -237,7 +237,7 @@ shared_examples_for "update questions" do
|
|
|
237
237
|
|
|
238
238
|
click_on "Save"
|
|
239
239
|
|
|
240
|
-
expect(page).to
|
|
240
|
+
expect(page).to have_callout(callout_success)
|
|
241
241
|
|
|
242
242
|
visit_manage_questions_and_expand_all
|
|
243
243
|
|
|
@@ -300,7 +300,7 @@ shared_examples_for "update questions" do
|
|
|
300
300
|
|
|
301
301
|
click_on "Save"
|
|
302
302
|
|
|
303
|
-
expect(page).to
|
|
303
|
+
expect(page).to have_callout(callout_success)
|
|
304
304
|
|
|
305
305
|
visit_manage_questions_and_expand_all
|
|
306
306
|
|
|
@@ -592,7 +592,7 @@ shared_examples_for "update questions" do
|
|
|
592
592
|
sleep 0.5
|
|
593
593
|
|
|
594
594
|
click_on "Save"
|
|
595
|
-
expect(page).to
|
|
595
|
+
expect(page).to have_callout(callout_success)
|
|
596
596
|
|
|
597
597
|
visit_manage_questions_and_expand_all
|
|
598
598
|
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-forms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.32.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
8
8
|
- Marc Riera Casals
|
|
9
9
|
- Oriol Gual Oliva
|
|
10
10
|
- Rubén González Valero
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: decidim-core
|
|
@@ -19,42 +18,42 @@ dependencies:
|
|
|
19
18
|
requirements:
|
|
20
19
|
- - '='
|
|
21
20
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.
|
|
21
|
+
version: 0.32.0.rc1
|
|
23
22
|
type: :runtime
|
|
24
23
|
prerelease: false
|
|
25
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
25
|
requirements:
|
|
27
26
|
- - '='
|
|
28
27
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: 0.
|
|
28
|
+
version: 0.32.0.rc1
|
|
30
29
|
- !ruby/object:Gem::Dependency
|
|
31
30
|
name: decidim-admin
|
|
32
31
|
requirement: !ruby/object:Gem::Requirement
|
|
33
32
|
requirements:
|
|
34
33
|
- - '='
|
|
35
34
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 0.
|
|
35
|
+
version: 0.32.0.rc1
|
|
37
36
|
type: :development
|
|
38
37
|
prerelease: false
|
|
39
38
|
version_requirements: !ruby/object:Gem::Requirement
|
|
40
39
|
requirements:
|
|
41
40
|
- - '='
|
|
42
41
|
- !ruby/object:Gem::Version
|
|
43
|
-
version: 0.
|
|
42
|
+
version: 0.32.0.rc1
|
|
44
43
|
- !ruby/object:Gem::Dependency
|
|
45
44
|
name: decidim-dev
|
|
46
45
|
requirement: !ruby/object:Gem::Requirement
|
|
47
46
|
requirements:
|
|
48
47
|
- - '='
|
|
49
48
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: 0.
|
|
49
|
+
version: 0.32.0.rc1
|
|
51
50
|
type: :development
|
|
52
51
|
prerelease: false
|
|
53
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
53
|
requirements:
|
|
55
54
|
- - '='
|
|
56
55
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: 0.
|
|
56
|
+
version: 0.32.0.rc1
|
|
58
57
|
description: A forms gem for decidim.
|
|
59
58
|
email:
|
|
60
59
|
- josepjaume@gmail.com
|
|
@@ -287,8 +286,6 @@ files:
|
|
|
287
286
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/draggable_behavior.rb
|
|
288
287
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb
|
|
289
288
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb
|
|
290
|
-
- lib/decidim/forms/test/shared_examples/questionnaire_admin_access.rb
|
|
291
|
-
- lib/decidim/forms/test/shared_examples/questionnaire_admin_controller_permissions.rb
|
|
292
289
|
- lib/decidim/forms/user_responses_serializer.rb
|
|
293
290
|
- lib/decidim/forms/version.rb
|
|
294
291
|
homepage: https://decidim.org
|
|
@@ -300,7 +297,6 @@ metadata:
|
|
|
300
297
|
funding_uri: https://opencollective.com/decidim
|
|
301
298
|
homepage_uri: https://decidim.org
|
|
302
299
|
source_code_uri: https://github.com/decidim/decidim
|
|
303
|
-
post_install_message:
|
|
304
300
|
rdoc_options: []
|
|
305
301
|
require_paths:
|
|
306
302
|
- lib
|
|
@@ -308,15 +304,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
308
304
|
requirements:
|
|
309
305
|
- - "~>"
|
|
310
306
|
- !ruby/object:Gem::Version
|
|
311
|
-
version: 3.
|
|
307
|
+
version: 3.4.0
|
|
312
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
313
309
|
requirements:
|
|
314
310
|
- - ">="
|
|
315
311
|
- !ruby/object:Gem::Version
|
|
316
312
|
version: '0'
|
|
317
313
|
requirements: []
|
|
318
|
-
rubygems_version: 3.
|
|
319
|
-
signing_key:
|
|
314
|
+
rubygems_version: 3.6.9
|
|
320
315
|
specification_version: 4
|
|
321
316
|
summary: Decidim forms
|
|
322
317
|
test_files: []
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
shared_examples_for "questionnaire admin access" do |denied_error:, allow_process_admin: true|
|
|
6
|
-
context "when the user is not an admin", driver: :rack_test do
|
|
7
|
-
let(:regular_user) { create(:user, :confirmed, organization:) }
|
|
8
|
-
let(:target_path) { manage_questions_path }
|
|
9
|
-
|
|
10
|
-
before do
|
|
11
|
-
login_as regular_user, scope: :user
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
before do
|
|
15
|
-
allow(Rails.application).to \
|
|
16
|
-
receive(:env_config).with(no_args).and_wrap_original do |m, *|
|
|
17
|
-
m.call.merge(
|
|
18
|
-
"action_dispatch.show_exceptions" => true,
|
|
19
|
-
"action_dispatch.show_detailed_exceptions" => false
|
|
20
|
-
)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
visit target_path
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it "leads to an error" do
|
|
27
|
-
denied_response = case denied_error
|
|
28
|
-
when 403
|
|
29
|
-
page.status_code == 403 || page.has_content?("You are not authorized to perform this action")
|
|
30
|
-
when 404
|
|
31
|
-
page.status_code == 404 || page.has_content?("The page you are looking for cannot be found")
|
|
32
|
-
else
|
|
33
|
-
raise ArgumentError, "unsupported denied_error: #{denied_error.inspect}. Use 403 or 404"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
expect(denied_response).to be(true)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
if allow_process_admin
|
|
41
|
-
context "when the user is a process admin" do
|
|
42
|
-
let(:process_admin) { create(:process_admin, :confirmed, participatory_process:) }
|
|
43
|
-
|
|
44
|
-
it "allows access to the questionnaire" do
|
|
45
|
-
login_as process_admin, scope: :user
|
|
46
|
-
visit manage_questions_path
|
|
47
|
-
|
|
48
|
-
expect(page).to have_current_path(manage_questions_path)
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
else
|
|
52
|
-
context "when the user is a process admin", driver: :rack_test do
|
|
53
|
-
let(:participatory_process) { create(:participatory_process, organization:) }
|
|
54
|
-
let(:process_admin) { create(:process_admin, :confirmed, participatory_process:) }
|
|
55
|
-
|
|
56
|
-
before do
|
|
57
|
-
login_as process_admin, scope: :user
|
|
58
|
-
|
|
59
|
-
allow(Rails.application).to \
|
|
60
|
-
receive(:env_config).with(no_args).and_wrap_original do |m, *|
|
|
61
|
-
m.call.merge(
|
|
62
|
-
"action_dispatch.show_exceptions" => true,
|
|
63
|
-
"action_dispatch.show_detailed_exceptions" => false
|
|
64
|
-
)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
visit manage_questions_path
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
it "denies access to the questionnaire" do
|
|
71
|
-
denied_response = case denied_error
|
|
72
|
-
when 403
|
|
73
|
-
page.status_code == 403 || page.has_content?("You are not authorized to perform this action")
|
|
74
|
-
when 404
|
|
75
|
-
page.status_code == 404 || page.has_content?("The page you are looking for cannot be found")
|
|
76
|
-
else
|
|
77
|
-
raise ArgumentError, "unsupported denied_error: #{denied_error.inspect}. Use 403 or 404"
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
expect(denied_response).to be(true)
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
context "when the user is an admin" do
|
|
86
|
-
let(:admin) { create(:user, :admin, :confirmed, organization:) }
|
|
87
|
-
|
|
88
|
-
it "allows access to the questionnaire" do
|
|
89
|
-
login_as admin, scope: :user
|
|
90
|
-
visit manage_questions_path
|
|
91
|
-
|
|
92
|
-
expect(page).to have_current_path(manage_questions_path)
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
shared_examples_for "questionnaire admin controller permissions" do
|
|
6
|
-
describe "GET #edit" do
|
|
7
|
-
let(:action) { :edit }
|
|
8
|
-
|
|
9
|
-
it "enforces permission to update the questionnaire" do
|
|
10
|
-
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
11
|
-
get action
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
describe "PATCH #update" do
|
|
16
|
-
let(:action) { :update }
|
|
17
|
-
|
|
18
|
-
it "enforces permission to update the questionnaire" do
|
|
19
|
-
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
20
|
-
patch action, params: { questionnaire: {} }
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
describe "GET #edit_questions" do
|
|
25
|
-
let(:action) { :edit_questions }
|
|
26
|
-
|
|
27
|
-
it "enforces permission to update the questionnaire" do
|
|
28
|
-
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
29
|
-
get action
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
describe "PATCH #update_questions" do
|
|
34
|
-
let(:action) { :update_questions }
|
|
35
|
-
|
|
36
|
-
it "enforces permission to update the questionnaire" do
|
|
37
|
-
expect(controller).to receive(:enforce_permission_to).with(:update, permission_subject, questionnaire:)
|
|
38
|
-
patch action, params: { questions: {} }
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|