surveyor_gui 0.0.3
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 +7 -0
- data/.gitignore +44 -0
- data/.travis.yml +17 -0
- data/Gemfile +7 -0
- data/LICENSE +21 -0
- data/MIT-LICENSE +20 -0
- data/README.md +159 -0
- data/Rakefile +66 -0
- data/app/controllers/answers_controller.rb +3 -0
- data/app/controllers/application_controller.rb +3 -0
- data/app/controllers/dependencys_controller.rb +286 -0
- data/app/controllers/question_groups_controller.rb +84 -0
- data/app/controllers/questions_controller.rb +187 -0
- data/app/controllers/survey_sections_controller.rb +80 -0
- data/app/controllers/surveyforms_controller.rb +4 -0
- data/app/controllers/surveyor_controller.rb +89 -0
- data/app/controllers/surveyor_gui/reports_controller.rb +339 -0
- data/app/controllers/surveyor_gui/responses_controller.rb +39 -0
- data/app/controllers/surveyor_gui/survey_controller.rb +16 -0
- data/app/facades/report_formatter.rb +44 -0
- data/app/facades/report_preview_wrapper.rb +11 -0
- data/app/facades/report_response_generator.rb +147 -0
- data/app/helpers/application_helper.rb +2 -0
- data/app/helpers/dependency_helper.rb +5 -0
- data/app/helpers/question_helper.rb +22 -0
- data/app/helpers/surveyform_helper.rb +179 -0
- data/app/helpers/surveyor_gui/report_helper.rb +19 -0
- data/app/helpers/surveyor_helper.rb +4 -0
- data/app/inputs/currency_input.rb +5 -0
- data/app/inputs/date_picker_input.rb +7 -0
- data/app/inputs/datetime_picker_input.rb +5 -0
- data/app/inputs/percent_input.rb +5 -0
- data/app/inputs/time_picker_input.rb +5 -0
- data/app/mailers/.gitkeep +0 -0
- data/app/models/.gitkeep +0 -0
- data/app/models/answer.rb +4 -0
- data/app/models/column.rb +3 -0
- data/app/models/dependency.rb +4 -0
- data/app/models/dependency_condition.rb +4 -0
- data/app/models/permitted_params_decorator.rb +80 -0
- data/app/models/question.rb +4 -0
- data/app/models/question_group.rb +4 -0
- data/app/models/question_type.rb +7 -0
- data/app/models/response.rb +4 -0
- data/app/models/response_set.rb +4 -0
- data/app/models/row.rb +3 -0
- data/app/models/survey.rb +4 -0
- data/app/models/survey_section.rb +4 -0
- data/app/models/surveyform.rb +103 -0
- data/app/uploaders/blob_uploader.rb +48 -0
- data/app/views/dependencys/_column.html.erb +1 -0
- data/app/views/dependencys/_dependency.html.erb +22 -0
- data/app/views/dependencys/_dependency_condition_fields.html.erb +48 -0
- data/app/views/dependencys/_form.html.erb +20 -0
- data/app/views/dependencys/blank.html.erb +0 -0
- data/app/views/dependencys/edit.html.erb +1 -0
- data/app/views/dependencys/new.html.erb +1 -0
- data/app/views/layouts/application.html.erb +14 -0
- data/app/views/layouts/surveyor_gui_blank.html.erb +12 -0
- data/app/views/layouts/surveyor_gui_default.html.erb +16 -0
- data/app/views/layouts/surveyor_modified.html.erb +14 -0
- data/app/views/partials/_answer.html.haml +33 -0
- data/app/views/partials/_question.html.haml +33 -0
- data/app/views/partials/_question_group.html.haml +73 -0
- data/app/views/partials/_section.html.haml +13 -0
- data/app/views/question_groups/_form.html.erb +56 -0
- data/app/views/question_groups/_group_inline_field.html.erb +21 -0
- data/app/views/question_groups/_group_inline_fields.html.erb +25 -0
- data/app/views/question_groups/blank.html.erb +0 -0
- data/app/views/question_groups/edit.html.erb +1 -0
- data/app/views/question_groups/new.html.erb +1 -0
- data/app/views/questions/_answer_fields.html.erb +23 -0
- data/app/views/questions/_answer_options.html.erb +28 -0
- data/app/views/questions/_form.html.erb +65 -0
- data/app/views/questions/_grid_dropdown_columns.html.erb +10 -0
- data/app/views/questions/_grid_dropdown_fields.html.erb +42 -0
- data/app/views/questions/_grid_fields.html.erb +9 -0
- data/app/views/questions/_no_picks.html.erb +29 -0
- data/app/views/questions/_pick.html +21 -0
- data/app/views/questions/_picks.html.erb +12 -0
- data/app/views/questions/blank.html.erb +0 -0
- data/app/views/questions/edit.html.erb +1 -0
- data/app/views/questions/new.html.erb +1 -0
- data/app/views/survey_sections/_form.html.erb +13 -0
- data/app/views/survey_sections/blank.html.erb +0 -0
- data/app/views/survey_sections/edit.html.erb +1 -0
- data/app/views/survey_sections/new.html.erb +1 -0
- data/app/views/surveyforms/_form.html.erb +50 -0
- data/app/views/surveyforms/_question_field.html.erb +148 -0
- data/app/views/surveyforms/_question_group.html.erb +116 -0
- data/app/views/surveyforms/_question_group_fields.html.erb +3 -0
- data/app/views/surveyforms/_question_name_and_number.html.erb +6 -0
- data/app/views/surveyforms/_question_section.html.erb +15 -0
- data/app/views/surveyforms/_question_wrapper.html.erb +109 -0
- data/app/views/surveyforms/_survey_section_fields.html.erb +138 -0
- data/app/views/surveyforms/clone_survey.html.erb +13 -0
- data/app/views/surveyforms/edit.html.erb +5 -0
- data/app/views/surveyforms/index.html.erb +40 -0
- data/app/views/surveyforms/new.html.erb +1 -0
- data/app/views/surveyforms/show.html.erb +5 -0
- data/app/views/surveyor_gui/reports/_graphs.html.haml +21 -0
- data/app/views/surveyor_gui/reports/_grid.html.haml +42 -0
- data/app/views/surveyor_gui/reports/_grid_dropdown.html.haml +56 -0
- data/app/views/surveyor_gui/reports/_repeater.html.haml +28 -0
- data/app/views/surveyor_gui/reports/_show_report.html.haml +33 -0
- data/app/views/surveyor_gui/reports/_single_question.html.haml +70 -0
- data/app/views/surveyor_gui/reports/show.html.erb +14 -0
- data/app/views/surveyor_gui/responses/_grid.html.haml +20 -0
- data/app/views/surveyor_gui/responses/_grid_dropdown.html.haml +20 -0
- data/app/views/surveyor_gui/responses/_repeater.html.haml +22 -0
- data/app/views/surveyor_gui/responses/_survey_results.html.haml +40 -0
- data/app/views/surveyor_gui/responses/index.html.haml +24 -0
- data/app/views/surveyor_gui/responses/show.html.haml +42 -0
- data/app/views/surveyor_gui/shared/_grid_comments.html.haml +10 -0
- data/app/views/surveyor_gui/shared/_new_line.html.haml +2 -0
- data/app/views/surveyor_gui/shared/_pick_comments.html.haml +15 -0
- data/app/views/surveyor_gui/shared/_question_number.html.haml +9 -0
- data/app/views/surveyor_gui/shared/_report_data.html.haml +24 -0
- data/app/views/surveyor_gui/shared/_stars_report_data.html.haml +14 -0
- data/config.ru +4 -0
- data/config/environment.rb +0 -0
- data/config/routes.rb +71 -0
- data/db/migrate/20140307204049_add_template_to_surveys.rb +5 -0
- data/db/migrate/20140307235607_add_test_data_to_response_sets.rb +5 -0
- data/db/migrate/20140308171947_add_original_choice_to_answers.rb +5 -0
- data/db/migrate/20140308172118_add_blob_to_responses.rb +5 -0
- data/db/migrate/20140308172417_add_modifiable_to_survey_section.rb +5 -0
- data/db/migrate/20140308174532_add_modifiable_to_question.rb +5 -0
- data/db/migrate/20140308175305_add_dynamically_generate_to_questions.rb +5 -0
- data/db/migrate/20140311032923_add_dummy_blob_to_questions.rb +5 -0
- data/db/migrate/20140311160609_add_dynamic_source_to_questions.rb +5 -0
- data/db/migrate/20140311161714_add_report_code_to_questions.rb +5 -0
- data/db/migrate/20140530181134_add_is_comment_to_questions.rb +5 -0
- data/db/migrate/20140531012006_add_is_comment_to_answers.rb +5 -0
- data/db/migrate/20140531225529_create_rows.rb +9 -0
- data/db/migrate/20140601011151_create_columns.rb +11 -0
- data/db/migrate/20140602030330_add_column_id_to_answers.rb +5 -0
- data/db/migrate/20140603155606_add_column_id_to_responses.rb +5 -0
- data/db/migrate/20140606023527_add_column_id_to_dependency_conditions.rb +5 -0
- data/db/migrate/20140815165307_add_user_id_to_survey.rb +5 -0
- data/lib/assets/.gitkeep +0 -0
- data/lib/assets/images/addicon.png +0 -0
- data/lib/assets/images/datepicker.gif +0 -0
- data/lib/assets/images/delete.gif +0 -0
- data/lib/assets/images/delete.png +0 -0
- data/lib/assets/images/images/border.png +0 -0
- data/lib/assets/images/images/controls.png +0 -0
- data/lib/assets/images/images/loading.gif +0 -0
- data/lib/assets/images/images/loading_background.png +0 -0
- data/lib/assets/images/images/overlay.png +0 -0
- data/lib/assets/images/rails.png +0 -0
- data/lib/assets/images/star.gif +0 -0
- data/lib/assets/javascripts/.gitkeep +0 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.MetaData.js +121 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.blockUI.js +619 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.rating.js +377 -0
- data/lib/assets/javascripts/surveyor_gui/jquery.validate.js +1188 -0
- data/lib/assets/javascripts/surveyor_gui/surveyor_add_ons.js +10 -0
- data/lib/assets/javascripts/surveyor_gui/surveyor_gui.js +1417 -0
- data/lib/assets/stylesheets/.gitkeep +0 -0
- data/lib/assets/stylesheets/surveyor_gui/jquery.rating.css +12 -0
- data/lib/assets/stylesheets/surveyor_gui/surveyor_add_ons.css +3 -0
- data/lib/assets/stylesheets/surveyor_gui/surveyor_gui.sass +650 -0
- data/lib/enumerable_extenders.rb +31 -0
- data/lib/generators/surveyor_gui/install_generator.rb +57 -0
- data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_add_ons.js +2 -0
- data/lib/generators/surveyor_gui/templates/app/assets/javascripts/surveyor_gui_all.js +24 -0
- data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_add_ons.css.sass +1 -0
- data/lib/generators/surveyor_gui/templates/app/assets/stylesheets/surveyor_gui_all.css.sass +8 -0
- data/lib/generators/surveyor_gui/templates/app/helpers/surveyor_helper.rb +4 -0
- data/lib/generators/surveyor_gui/templates/app/models/response_set_user.rb +13 -0
- data/lib/generators/surveyor_gui/templates/app/views/layouts/surveyor_gui_default.html.erb +16 -0
- data/lib/generators/surveyor_gui/templates/config/initializers/simple_form.rb +140 -0
- data/lib/generators/surveyor_gui/templates/config/locales/en.yml +5 -0
- data/lib/surveyor_gui.rb +17 -0
- data/lib/surveyor_gui/engine.rb +30 -0
- data/lib/surveyor_gui/helpers/surveyor_helper_methods.rb +19 -0
- data/lib/surveyor_gui/models/answer_methods.rb +24 -0
- data/lib/surveyor_gui/models/column_methods.rb +43 -0
- data/lib/surveyor_gui/models/dependency_condition_methods.rb +53 -0
- data/lib/surveyor_gui/models/dependency_methods.rb +83 -0
- data/lib/surveyor_gui/models/question_and_group_shared_methods.rb +11 -0
- data/lib/surveyor_gui/models/question_group_methods.rb +55 -0
- data/lib/surveyor_gui/models/question_methods.rb +435 -0
- data/lib/surveyor_gui/models/question_type_methods.rb +493 -0
- data/lib/surveyor_gui/models/response_methods.rb +67 -0
- data/lib/surveyor_gui/models/response_set_methods.rb +54 -0
- data/lib/surveyor_gui/models/row_methods.rb +11 -0
- data/lib/surveyor_gui/models/survey_methods.rb +32 -0
- data/lib/surveyor_gui/models/survey_section_methods.rb +32 -0
- data/lib/surveyor_gui/surveyforms_controller_methods.rb +258 -0
- data/lib/surveyor_gui/version.rb +3 -0
- data/lib/tasks/.gitkeep +0 -0
- data/lib/tasks/surveyor_gui_tasks.rake +4 -0
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- data/spec/controllers/surveyforms_controller_spec.rb +361 -0
- data/spec/controllers/surveyor_controller_spec.rb +303 -0
- data/spec/factories.rb +181 -0
- data/spec/features/create_survey_spec.rb +418 -0
- data/spec/features/dependencies_spec.rb +61 -0
- data/spec/features/rearrange_survey_spec.rb +118 -0
- data/spec/features/ui_spec.rb +469 -0
- data/spec/fixtures/REDCapDemoDatabase_DataDictionary.csv +127 -0
- data/spec/fixtures/chinese_survey.rb +14 -0
- data/spec/fixtures/everything.rb +215 -0
- data/spec/fixtures/favorites-ish.rb +22 -0
- data/spec/fixtures/favorites.rb +22 -0
- data/spec/fixtures/feelings.rb +38 -0
- data/spec/fixtures/lifestyle.rb +55 -0
- data/spec/fixtures/numbers.rb +21 -0
- data/spec/fixtures/redcap_new_headers.csv +1 -0
- data/spec/fixtures/redcap_siblings.csv +1 -0
- data/spec/fixtures/redcap_whitespace.csv +1 -0
- data/spec/helpers/formtastic_custom_input_spec.rb +15 -0
- data/spec/helpers/surveyor_helper_spec.rb +116 -0
- data/spec/lib/common_spec.rb +37 -0
- data/spec/lib/parser_spec.rb +393 -0
- data/spec/lib/rake_kitchen_sink.rb +42 -0
- data/spec/lib/redcap_parser_spec.rb +129 -0
- data/spec/lib/unparser_spec.rb +126 -0
- data/spec/models/answer_spec.rb +144 -0
- data/spec/models/dependency_condition_spec.rb +428 -0
- data/spec/models/dependency_spec.rb +90 -0
- data/spec/models/question_group_spec.rb +66 -0
- data/spec/models/question_spec.rb +176 -0
- data/spec/models/response_set_spec.rb +452 -0
- data/spec/models/response_spec.rb +208 -0
- data/spec/models/survey_section_spec.rb +58 -0
- data/spec/models/survey_spec.rb +155 -0
- data/spec/models/surveyor_gui/question_spec.rb +60 -0
- data/spec/models/surveyor_gui/question_type_spec.rb +268 -0
- data/spec/models/validation_condition_spec.rb +98 -0
- data/spec/models/validation_spec.rb +64 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +119 -0
- data/spec/support/scenario_outline_helper.rb +39 -0
- data/spec/support/shared.rb +10 -0
- data/spec/support/surveyforms_creation_helpers.rb +312 -0
- data/spec/support/surveyforms_rearrangement_helpers.rb +170 -0
- data/spec/support/surveyor_api_helpers.rb +15 -0
- data/spec/support/surveyor_ui_helpers.rb +108 -0
- data/spec/support/wait_for_ajax.rb +11 -0
- data/spec/views/questions/edit.html.erb_spec.rb +73 -0
- data/spec/views/surveyforms/edit.html.erb_spec.rb +126 -0
- data/surveyor_gui.gemspec +52 -0
- data/test/dummy/README.rdoc +261 -0
- data/test/dummy/Rakefile +7 -0
- data/test/dummy/app/assets/javascripts/application.js +15 -0
- data/test/dummy/app/assets/stylesheets/application.css +13 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/mailers/.gitkeep +0 -0
- data/test/dummy/app/models/.gitkeep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +59 -0
- data/test/dummy/config/boot.rb +10 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +67 -0
- data/test/dummy/config/environments/test.rb +37 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/inflections.rb +15 -0
- data/test/dummy/config/initializers/mime_types.rb +5 -0
- data/test/dummy/config/initializers/secret_token.rb +7 -0
- data/test/dummy/config/initializers/session_store.rb +8 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +5 -0
- data/test/dummy/config/routes.rb +58 -0
- data/test/dummy/lib/assets/.gitkeep +0 -0
- data/test/dummy/log/.gitkeep +0 -0
- data/test/dummy/public/404.html +26 -0
- data/test/dummy/public/422.html +26 -0
- data/test/dummy/public/500.html +25 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +6 -0
- data/test/surveyor-gui_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- data/vendor/assets/stylesheets/.gitkeep +0 -0
- data/vendor/assets/stylesheets/custom.sass +5 -0
- data/vendor/plugins/.gitkeep +0 -0
- metadata +664 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
#from spec/support/surveyforms_helpers.rb
|
3
|
+
include SurveyFormsCreationHelpers::CreateSurvey
|
4
|
+
include SurveyFormsCreationHelpers::BuildASurvey
|
5
|
+
|
6
|
+
feature "User creates a dependency using browser", %q{
|
7
|
+
As a user
|
8
|
+
I want to create logic on questions
|
9
|
+
So that I can display one question depending on the answer to another} do
|
10
|
+
|
11
|
+
let!(:survey){FactoryGirl.create(:survey, title: "Hotel ratings")}
|
12
|
+
let!(:survey_section){FactoryGirl.create(:survey_section, survey: survey)}
|
13
|
+
let!(:question1) {FactoryGirl.create(:question, survey_section: survey_section, text: "Rate the service")}
|
14
|
+
let!(:answer1) {FactoryGirl.create(:answer, question: question1, text: "yes", display_type: "default", response_class: "answer")}
|
15
|
+
let!(:answer2) {FactoryGirl.create(:answer, question: question1, text: "no", display_type: "default", response_class: "answer")}
|
16
|
+
let!(:question2) {FactoryGirl.create(:question, survey_section: survey_section, text: "Who was your concierge?")}
|
17
|
+
let!(:answer2) {FactoryGirl.create(:answer, question: question2)}
|
18
|
+
before :each do
|
19
|
+
question1.pick = "one"
|
20
|
+
question1.save!
|
21
|
+
question1.reload
|
22
|
+
end
|
23
|
+
|
24
|
+
scenario "user creates a dependency", js: true do
|
25
|
+
#Given I have a survey with two questions
|
26
|
+
visit surveyforms_path
|
27
|
+
expect(page).to have_content("Hotel ratings")
|
28
|
+
within "tr", text: "Hotel ratings" do
|
29
|
+
click_link "Edit"
|
30
|
+
end
|
31
|
+
expect(page).to have_content("Rate the service")
|
32
|
+
#And I click Add Logic on the second question
|
33
|
+
within "fieldset.questions", text: "Who was your concierge" do
|
34
|
+
click_button "Add Logic"
|
35
|
+
end
|
36
|
+
#Then I see a window pop-up
|
37
|
+
expect(page).to have_css('iframe')
|
38
|
+
within_frame 0 do
|
39
|
+
#And it has logic, which defaults to checking the first question for the answer "yes"
|
40
|
+
expect(page).to have_content("conditions")
|
41
|
+
click_button "Save Changes"
|
42
|
+
end
|
43
|
+
#Then I see that this survey has been updated to include a dependency
|
44
|
+
expect(page).to have_content("This question is shown depending on the answer to question 1).")
|
45
|
+
visit surveyor_path
|
46
|
+
expect(page).to have_content("You may take these surveys")
|
47
|
+
within "li", text: "Hotel ratings" do
|
48
|
+
#And I take the newly created survey
|
49
|
+
click_button "Take it"
|
50
|
+
end
|
51
|
+
expect(page).to have_content("Hotel ratings")
|
52
|
+
expect(page).to have_content("Rate the service")
|
53
|
+
expect(page).to have_css('input[type="radio"][value="'+answer1.id.to_s+'"]')
|
54
|
+
#Then I don't see the second question just yet
|
55
|
+
expect(page).not_to have_content("Who was your concierge?")
|
56
|
+
#When I click yes as the answer to the first question
|
57
|
+
choose "yes"
|
58
|
+
#Then the second question magically appears
|
59
|
+
expect(page).to have_content("Who was your concierge?")
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
#from spec/support/surveyforms_helpers.rb
|
4
|
+
include SurveyFormsCreationHelpers::CreateSurvey
|
5
|
+
include SurveyFormsCreationHelpers::BuildASurvey
|
6
|
+
|
7
|
+
feature "Survey Creator rearranges survey", %q{
|
8
|
+
As a Survey Creator
|
9
|
+
I want to rearrange a survey
|
10
|
+
So that I can change my mind if I don't like the order of sections and questions} do
|
11
|
+
|
12
|
+
#force a cr/lf to make the output look better
|
13
|
+
scenario " " do
|
14
|
+
end
|
15
|
+
context "Survey creator rearranges questions", :js=>true do
|
16
|
+
before :each do
|
17
|
+
build_a_three_question_survey
|
18
|
+
end
|
19
|
+
|
20
|
+
#include helpers to simulate Cucumber type Scenario Outline.
|
21
|
+
#Found in spec/support/surveyforms_rearrangement_helpers.rb
|
22
|
+
include_context "question_cut_and_paste"
|
23
|
+
|
24
|
+
#Given that my survey has unique questions 1, 2, and 3 in order
|
25
|
+
#When I cut <from_item> and paste it <over_under> <to_item>
|
26
|
+
#Then I see questions in the correct <order>
|
27
|
+
#|from_item | over_under | to_item | order|
|
28
|
+
#|2 | over | 1 | 213 |
|
29
|
+
#|2 | over | 3 | 123 |
|
30
|
+
#|2 | under | 1 | 123 |
|
31
|
+
#|2 | under | 3 | 132 |
|
32
|
+
#|1 | over | 2 | 312 |
|
33
|
+
#|1 | over | 3 | 132 |
|
34
|
+
#|1 | under | 2 | 321 |
|
35
|
+
#|1 | under | 3 | 312 |
|
36
|
+
#|3 | over | 1 | 312 |
|
37
|
+
#|3 | over | 2 | 132 |
|
38
|
+
#|3 | under | 1 | 132 |
|
39
|
+
#|3 | under | 2 | 123 |
|
40
|
+
|
41
|
+
scenario "Survey Creator cuts and pastes questions" do
|
42
|
+
run_scenario
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context "Survey creator rearranges sections", :js=>true do
|
47
|
+
before :each do
|
48
|
+
build_a_three_section_survey
|
49
|
+
end
|
50
|
+
|
51
|
+
#include helpers to simulate Cucumber type Scenario Outline.
|
52
|
+
#Found in spec/support/surveyforms_rearrangement_helpers.rb
|
53
|
+
include_context "section_cut_and_paste"
|
54
|
+
|
55
|
+
#Given that my survey has unique sections 1, 2, and 3 in order
|
56
|
+
#When I cut <from_item> and paste it <over_under> <to_item>
|
57
|
+
#Then I see sections in the correct <order> per same table as used for questions
|
58
|
+
scenario "Survey Creator cuts and pastes sections" do
|
59
|
+
run_scenario
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "Survey creator rearranges questions and sections together", :js=>true do
|
64
|
+
before :each do
|
65
|
+
build_a_survey
|
66
|
+
end
|
67
|
+
|
68
|
+
include_context "question_and_section_cut_and_paste"
|
69
|
+
scenario "Survey Creator cuts and pastes questions and sections" do
|
70
|
+
#Given that my survey has questions in the wrong sections
|
71
|
+
#and sections in the wrong order:
|
72
|
+
puts """
|
73
|
+
started with this survey:
|
74
|
+
Accommodations:
|
75
|
+
Describe your day at Fenway Park.
|
76
|
+
Entertainment:
|
77
|
+
Describe your room.
|
78
|
+
Food: """
|
79
|
+
expect(page).to have_content(Regexp.new(
|
80
|
+
"""
|
81
|
+
Accommodations.*
|
82
|
+
Describe your day at Fenway Park\..*
|
83
|
+
Entertainment.*
|
84
|
+
Describe your room\..*
|
85
|
+
Food
|
86
|
+
""".gsub(/\n\s*/,"").strip
|
87
|
+
))
|
88
|
+
|
89
|
+
#When I move questions to the appropriate sections
|
90
|
+
cut_question("Describe your day at Fenway Park.")
|
91
|
+
paste_question("over", "Describe your room.")
|
92
|
+
cut_question("Describe your room.")
|
93
|
+
paste_question("under", "How many days did you stay?")
|
94
|
+
|
95
|
+
#And I arrange sections in the appropriate order
|
96
|
+
cut_section("Accommodations")
|
97
|
+
paste_section("under", "Food")
|
98
|
+
|
99
|
+
#Then the survey is organized correctly:
|
100
|
+
puts """
|
101
|
+
ended with this survey:
|
102
|
+
Entertainment:
|
103
|
+
Describe your day at Fenway Park.
|
104
|
+
Food:
|
105
|
+
Accommodations:
|
106
|
+
Describe your room. """
|
107
|
+
expect(page).to have_content(Regexp.new(
|
108
|
+
"""
|
109
|
+
Entertainment.*
|
110
|
+
Describe your day at Fenway Park\..*
|
111
|
+
Food.*
|
112
|
+
Accommodations.*
|
113
|
+
Describe your room\.
|
114
|
+
""".gsub(/\n\s*/,"").strip
|
115
|
+
))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,469 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "ui interactions" do
|
4
|
+
context "saves responses" do
|
5
|
+
include_context "everything"
|
6
|
+
it "radio button" do
|
7
|
+
response_set = start_survey('Everything')
|
8
|
+
expect(page).to have_content("What is your favorite color?")
|
9
|
+
within question("1") do
|
10
|
+
choose "red"
|
11
|
+
choose "blue"
|
12
|
+
end
|
13
|
+
click_button "Next section"
|
14
|
+
expect(response_set.count).to eq(1)
|
15
|
+
end
|
16
|
+
it "dropdown" do
|
17
|
+
response_set = start_survey('Everything')
|
18
|
+
expect(page).to have_content("What color is the sky right now?")
|
19
|
+
within question("3") do
|
20
|
+
select "sunset red", from: "What color is the sky right now?"
|
21
|
+
end
|
22
|
+
click_button "Next section"
|
23
|
+
expect(response_set.count).to eq(1)
|
24
|
+
expect(response_set.for("3", "sr").count).to eq(1)
|
25
|
+
click_button "Previous section"
|
26
|
+
within question("3") do
|
27
|
+
select "night black", from: "What color is the sky right now?"
|
28
|
+
end
|
29
|
+
click_button "Next section"
|
30
|
+
expect(response_set.count).to eq(1)
|
31
|
+
expect(response_set.for("3", "nb").count).to eq(1)
|
32
|
+
end
|
33
|
+
it "check and uncheck checkboxes" do
|
34
|
+
response_set = start_survey('Everything')
|
35
|
+
expect(page).to have_content("What color is the sky right now?")
|
36
|
+
check "orange"
|
37
|
+
click_button "Next section"
|
38
|
+
expect(response_set.count).to eq(1)
|
39
|
+
click_button "Previous section"
|
40
|
+
uncheck "orange"
|
41
|
+
click_button "Next section"
|
42
|
+
expect(response_set.count).to eq(0)
|
43
|
+
end
|
44
|
+
it "string" do
|
45
|
+
response_set = start_survey('Everything')
|
46
|
+
expect(page).to have_content("What is the best color for a fire engine?")
|
47
|
+
within question("fire_engine") do
|
48
|
+
fill_in "Color", with: "red"
|
49
|
+
end
|
50
|
+
click_button "Next section"
|
51
|
+
expect(response_set.count).to eq(1)
|
52
|
+
expect(response_set.for("fire_engine", "color").first.string_value).to eq("red")
|
53
|
+
end
|
54
|
+
it "free text" do
|
55
|
+
response_set = start_survey('Everything')
|
56
|
+
expect(page).to have_content("Please compose a poem about a color")
|
57
|
+
within question("color_poem") do
|
58
|
+
fill_in "Poem", with: "green, nature's color, you're not easy, but that's why you're worth it"
|
59
|
+
end
|
60
|
+
click_button "Next section"
|
61
|
+
expect(response_set.count).to eq(1)
|
62
|
+
expect(response_set.for("color_poem", "poem_text").first.text_value).to eq("green, nature's color, you're not easy, but that's why you're worth it")
|
63
|
+
end
|
64
|
+
it "date" do
|
65
|
+
response_set = start_survey('Everything')
|
66
|
+
expect(page).to have_content("When is the next color run?")
|
67
|
+
within question("color_run_date") do
|
68
|
+
fill_in "On", with: "2014-06-08"
|
69
|
+
end
|
70
|
+
click_button "Next section"
|
71
|
+
expect(response_set.count).to eq(1)
|
72
|
+
expect(response_set.for("color_run_date", "date").first.date_value).to eq("2014-06-08")
|
73
|
+
end
|
74
|
+
it "time" do
|
75
|
+
response_set = start_survey('Everything')
|
76
|
+
expect(page).to have_content("What time does it start?")
|
77
|
+
within question("color_run_time") do
|
78
|
+
fill_in "At", with: "1:30am"
|
79
|
+
end
|
80
|
+
click_button "Next section"
|
81
|
+
expect(response_set.count).to eq(1)
|
82
|
+
expect(response_set.for("color_run_time", "time").first.time_value).to eq("01:30")
|
83
|
+
end
|
84
|
+
it "datetime" do
|
85
|
+
response_set = start_survey('Everything')
|
86
|
+
expect(page).to have_content("When is your next hair color appointment?")
|
87
|
+
within question("hair_appointment") do
|
88
|
+
fill_in "At", with: "2014-06-08 17:00:00"
|
89
|
+
end
|
90
|
+
click_button "Next section"
|
91
|
+
expect(response_set.count).to eq(1)
|
92
|
+
expect(response_set.for("hair_appointment", "datetime").first.datetime_value).to eq(Time.zone.parse("2014-06-08 17:00:00"))
|
93
|
+
end
|
94
|
+
it "radio button with date" do
|
95
|
+
pending "better selectors"
|
96
|
+
# Issue 207 - Create separate fields for date and time
|
97
|
+
response_set = start_survey('Everything')
|
98
|
+
expect(page).to have_content("What is your birth date?")
|
99
|
+
within question("birth_date") do
|
100
|
+
choose "I was born on"
|
101
|
+
fill_in "I was born on", with: "2000-01-01"
|
102
|
+
end
|
103
|
+
click_button "Next section"
|
104
|
+
expect(response_set.count).to eq(1)
|
105
|
+
expect(response_set.for("birth_date", "date").first.date_value).to eq("2000-01-01")
|
106
|
+
end
|
107
|
+
it "checkbox with date" do
|
108
|
+
pending "better selectors"
|
109
|
+
# Issue 207 - Create separate fields for date and time
|
110
|
+
response_set = start_survey('Everything')
|
111
|
+
expect(page).to have_content("What is your birth date?")
|
112
|
+
within question("birth_time") do
|
113
|
+
choose "I was born at"
|
114
|
+
fill_in "I was born at", with: "12:01am"
|
115
|
+
end
|
116
|
+
click_button "Next section"
|
117
|
+
expect(response_set.count).to eq(1)
|
118
|
+
expect(response_set.for("birth_time", "time").first.date_value).to eq("00:01")
|
119
|
+
end
|
120
|
+
it "slider" do
|
121
|
+
pending "move slider programmatically"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
context "saves group responses" do
|
125
|
+
include_context "everything"
|
126
|
+
it "grid" do
|
127
|
+
response_set = start_survey('Everything')
|
128
|
+
click_button "Groups"
|
129
|
+
expect(page).to have_content("How interested are you in the following?")
|
130
|
+
within( grid_row("weddings")){ choose "interested" }
|
131
|
+
click_button "Next section"
|
132
|
+
expect(response_set.count).to eq(1)
|
133
|
+
end
|
134
|
+
it "repeater, repeater with a dropdown" do
|
135
|
+
pending "investigate failure later"
|
136
|
+
response_set = start_survey('Everything')
|
137
|
+
click_button "Groups"
|
138
|
+
expect(page).to have_content("Tell us about your family")
|
139
|
+
within group("family") do
|
140
|
+
select "Parent", from: "Relation"
|
141
|
+
fill_in "Name", with: "Mom"
|
142
|
+
fill_in "Quality of your relationship", with: "great"
|
143
|
+
end
|
144
|
+
click_button "Next section"
|
145
|
+
click_button "Previous section"
|
146
|
+
within group("family") do
|
147
|
+
within( question("relation", 1)){ select "Parent", from: "Relation" }
|
148
|
+
within( question("name", 1)){ fill_in "Name", with: "Dad" }
|
149
|
+
within( question("quality", 1)){ fill_in "Quality of your relationship", with: "great" }
|
150
|
+
end
|
151
|
+
click_button "Next section"
|
152
|
+
expect(response_set.count).to eq(6)
|
153
|
+
end
|
154
|
+
it "group with a dropdown" do
|
155
|
+
# Issue 251 - Dropdowns inside of group display as radio buttons
|
156
|
+
response_set = start_survey('Everything')
|
157
|
+
click_button "Groups"
|
158
|
+
expect(page).to have_content("Drop it like it's hot")
|
159
|
+
within group("drop_it") do
|
160
|
+
select "It", from: "What to drop"
|
161
|
+
end
|
162
|
+
click_button "Next section"
|
163
|
+
expect(response_set.count).to eq(1)
|
164
|
+
end
|
165
|
+
it "group with labels" do
|
166
|
+
response_set = start_survey('Everything')
|
167
|
+
click_button "Groups"
|
168
|
+
expect(page).to have_content("Drop it like it's hot")
|
169
|
+
within group("drop_it") do
|
170
|
+
expect(page).to have_content("Like Snoop Dogg said")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
context "dependencies" do
|
175
|
+
include_context "everything"
|
176
|
+
it "double letter rule keys" do
|
177
|
+
# for a dependency - try this with "lifestyle"
|
178
|
+
end
|
179
|
+
it "simple" do
|
180
|
+
end
|
181
|
+
it "inside a group" do
|
182
|
+
response_set = start_survey('Everything')
|
183
|
+
click_button "Dependencies"
|
184
|
+
expect(page).to have_hidden_question('who')
|
185
|
+
expect(page).to have_hidden_question('weird')
|
186
|
+
within question("anybody") do
|
187
|
+
choose "Yes"
|
188
|
+
end
|
189
|
+
click_button "Next section"
|
190
|
+
click_button "Previous section"
|
191
|
+
expect(page).to_not have_hidden_question('who')
|
192
|
+
expect(page).to have_hidden_question('weird')
|
193
|
+
within question("anybody") do
|
194
|
+
choose "No"
|
195
|
+
end
|
196
|
+
click_button "Next section"
|
197
|
+
click_button "Previous section"
|
198
|
+
expect(page).to have_hidden_question('who')
|
199
|
+
expect(page).to_not have_hidden_question('weird')
|
200
|
+
|
201
|
+
end
|
202
|
+
it "groups" do
|
203
|
+
response_set = start_survey('Everything')
|
204
|
+
click_button "Dependencies"
|
205
|
+
expect(page).to have_hidden_group('anybody_no')
|
206
|
+
within question("anybody") do
|
207
|
+
choose "No"
|
208
|
+
end
|
209
|
+
click_button "Next section"
|
210
|
+
click_button "Previous section"
|
211
|
+
expect(page).to_not have_hidden_group('anybody_no')
|
212
|
+
end
|
213
|
+
it "on question in dependent group" do
|
214
|
+
response_set = start_survey('Everything')
|
215
|
+
click_button "Dependencies"
|
216
|
+
expect(page).to have_hidden_question('feels_like_it')
|
217
|
+
within question("anybody") do
|
218
|
+
choose "No"
|
219
|
+
end
|
220
|
+
click_button "Next section"
|
221
|
+
click_button "Previous section"
|
222
|
+
expect(page).to have_hidden_question('feels_like_it')
|
223
|
+
within question("who_talking") do
|
224
|
+
choose "Are you nuts?"
|
225
|
+
end
|
226
|
+
click_button "Next section"
|
227
|
+
click_button "Previous section"
|
228
|
+
expect(page).to_not have_hidden_question('feels_like_it')
|
229
|
+
end
|
230
|
+
it "!= without responses" do
|
231
|
+
# Issue 337 answer != condition returns false if question was never activated
|
232
|
+
response_set = start_survey('Everything')
|
233
|
+
click_button "Dependencies"
|
234
|
+
expect(page).to have_content("How do you cool your home?")
|
235
|
+
expect(page).to_not have_hidden_question('cooling_2')
|
236
|
+
expect(page).to have_content("How much does it cost to run your non-passive cooling solutions?")
|
237
|
+
within question("cooling_1") do
|
238
|
+
choose "Passive"
|
239
|
+
end
|
240
|
+
click_button "Next section"
|
241
|
+
click_button "Previous section"
|
242
|
+
expect(page).to have_hidden_question('cooling_2')
|
243
|
+
end
|
244
|
+
it "!= without responses, count>0" do
|
245
|
+
# Issue 337 answer != condition returns false if question was never activated
|
246
|
+
response_set = start_survey('Everything')
|
247
|
+
click_button "Dependencies"
|
248
|
+
expect(page).to have_content("How do you heat your home?")
|
249
|
+
expect(page).to have_hidden_question('heating_2')
|
250
|
+
expect(page).to have_content("How much does it cost to run your non-passive heating solutions?")
|
251
|
+
within question("heating_1") do
|
252
|
+
check "Oven"
|
253
|
+
end
|
254
|
+
click_button "Next section"
|
255
|
+
click_button "Previous section"
|
256
|
+
expect(page).to_not have_hidden_question('heating_2')
|
257
|
+
end
|
258
|
+
it "count== dependencies" do
|
259
|
+
response_set = start_survey('Everything')
|
260
|
+
click_button "Dependencies"
|
261
|
+
expect(page).to have_content("How many times do you count a day")
|
262
|
+
expect(page).to have_hidden_question('counts_good')
|
263
|
+
expect(page).to have_hidden_question('counts_twice')
|
264
|
+
|
265
|
+
within question("counts") do
|
266
|
+
check "Once for me"
|
267
|
+
end
|
268
|
+
click_button "Next section"
|
269
|
+
click_button "Previous section"
|
270
|
+
expect(page).to_not have_hidden_question('counts_good')
|
271
|
+
expect(page).to have_hidden_question('counts_twice')
|
272
|
+
|
273
|
+
within question("counts") do
|
274
|
+
check "Once for you"
|
275
|
+
end
|
276
|
+
click_button "Next section"
|
277
|
+
click_button "Previous section"
|
278
|
+
expect(page).to have_hidden_question('counts_good')
|
279
|
+
expect(page).to_not have_hidden_question('counts_twice')
|
280
|
+
end
|
281
|
+
it "when the last response is removed" do
|
282
|
+
response_set = start_survey('Everything')
|
283
|
+
click_button "Dependencies"
|
284
|
+
expect(page).to have_content("How do you heat your home?")
|
285
|
+
expect(page).to have_hidden_question('heating_3')
|
286
|
+
|
287
|
+
within question("heating_1") do
|
288
|
+
check "Forced air"
|
289
|
+
end
|
290
|
+
click_button "Next section"
|
291
|
+
click_button "Previous section"
|
292
|
+
expect(page).to_not have_hidden_question('heating_3')
|
293
|
+
|
294
|
+
within question("heating_1") do
|
295
|
+
uncheck "Forced air"
|
296
|
+
end
|
297
|
+
click_button "Next section"
|
298
|
+
click_button "Previous section"
|
299
|
+
expect(page).to have_hidden_question('heating_3')
|
300
|
+
end
|
301
|
+
it "on checkboxes" do
|
302
|
+
response_set = start_survey('Everything')
|
303
|
+
click_button "Dependencies"
|
304
|
+
expect(page).to have_content("How many times do you count a day")
|
305
|
+
expect(page).to have_hidden_question('thanks_counting')
|
306
|
+
expect(page).to have_hidden_question('yay_everyone')
|
307
|
+
within question("counts") do
|
308
|
+
check "Once for me"
|
309
|
+
end
|
310
|
+
click_button "Next section"
|
311
|
+
click_button "Previous section"
|
312
|
+
expect(page).to_not have_hidden_question('thanks_counting')
|
313
|
+
expect(page).to have_hidden_question('yay_everyone')
|
314
|
+
|
315
|
+
within question("counts") do
|
316
|
+
check "Once for you"
|
317
|
+
end
|
318
|
+
click_button "Next section"
|
319
|
+
click_button "Previous section"
|
320
|
+
expect(page).to_not have_hidden_question('thanks_counting')
|
321
|
+
expect(page).to have_hidden_question('yay_everyone')
|
322
|
+
|
323
|
+
within question("counts") do
|
324
|
+
check "Once for everyone"
|
325
|
+
end
|
326
|
+
click_button "Next section"
|
327
|
+
click_button "Previous section"
|
328
|
+
expect(page).to_not have_hidden_question('thanks_counting')
|
329
|
+
expect(page).to_not have_hidden_question('yay_everyone')
|
330
|
+
end
|
331
|
+
end
|
332
|
+
context "special features" do
|
333
|
+
include_context "everything"
|
334
|
+
it "help text" do
|
335
|
+
response_set = start_survey('Everything')
|
336
|
+
click_button "Special"
|
337
|
+
within question("favorite_food") do
|
338
|
+
expect(page).to have_css("span.help", text: "just say beef")
|
339
|
+
end
|
340
|
+
end
|
341
|
+
it "images" do
|
342
|
+
response_set = start_survey('Everything')
|
343
|
+
click_button "Special"
|
344
|
+
within question("which_way") do
|
345
|
+
expect(page).to have_css('img[src^="/assets/surveyor/next.gif"]')
|
346
|
+
expect(page).to have_css('img[src^="/assets/surveyor/prev.gif"]')
|
347
|
+
end
|
348
|
+
end
|
349
|
+
it "custom css class" do
|
350
|
+
response_set = start_survey('Everything')
|
351
|
+
click_button "Special"
|
352
|
+
expect(page).to have_css("fieldset.q_default.hidden")
|
353
|
+
end
|
354
|
+
it "default answer" do
|
355
|
+
response_set = start_survey('Everything')
|
356
|
+
click_button "Special"
|
357
|
+
click_button "Click here to finish"
|
358
|
+
expect(response_set.count).to eq(1)
|
359
|
+
expect(response_set.for("favorite_food", "food").first.string_value).to eq("beef")
|
360
|
+
end
|
361
|
+
it "hidden questions" do
|
362
|
+
# Issue 197 - Add a hidden field type
|
363
|
+
# does not appear in DOM, does not receive question numering
|
364
|
+
response_set = start_survey('Everything')
|
365
|
+
click_button "Special"
|
366
|
+
expect(page).to_not have_content("What is your name?")
|
367
|
+
expect(page).to_not have_content("Friends")
|
368
|
+
expect(page).to_not have_content("Who are your friends?")
|
369
|
+
# custom class "hidden" does nothing unless you add your own css to hide it
|
370
|
+
expect(page).to have_content("5) What is your favorite number?")
|
371
|
+
end
|
372
|
+
it "customizing numbering" do
|
373
|
+
override_surveyor_helper_numbering
|
374
|
+
response_set = start_survey('Everything')
|
375
|
+
expect(page).to have_content("A. What is your favorite color?")
|
376
|
+
expect(page).to have_content("B. Choose the colors you don't like")
|
377
|
+
expect(page).to have_content("C. What color is the sky right now?")
|
378
|
+
expect(page).to have_content("D. What is the best color for a fire engine?")
|
379
|
+
expect(page).to have_content("E. What was the last room you painted, and what color?")
|
380
|
+
restore_surveyor_helper_numbering
|
381
|
+
end
|
382
|
+
it "mustache syntax" do
|
383
|
+
# Issue 259 - substitution of the text with Mustache
|
384
|
+
SurveyorController.send(:include, mustache_context_module(name: "Santa", thing: "beards"))
|
385
|
+
response_set = start_survey('Everything')
|
386
|
+
click_button "Special"
|
387
|
+
expect(page).to have_content("Regarding Santa")
|
388
|
+
expect(page).to have_content("Answer all you know about Santa")
|
389
|
+
expect(page).to have_content("Where does Santa live?")
|
390
|
+
expect(page).to have_content("If you don't know where Santa lives, skip the question")
|
391
|
+
expect(page).to have_content("Santa lives on North Pole")
|
392
|
+
expect(page).to have_content("Santa lives on South Pole")
|
393
|
+
expect(page).to have_content("Santa doesn't exist")
|
394
|
+
expect(page).to have_content("Now think about beards")
|
395
|
+
expect(page).to have_content("Yes, beards")
|
396
|
+
end
|
397
|
+
it "mustache with simple hash context" do
|
398
|
+
# Issue 296 - Mustache rendering doesn't work with simple hash contexts
|
399
|
+
SurveyorController.send(:include, hash_context_module({name: "Father Christmas", thing: "reindeer"}))
|
400
|
+
response_set = start_survey('Everything')
|
401
|
+
click_button "Special"
|
402
|
+
expect(page).to have_content("Regarding Father Christmas")
|
403
|
+
expect(page).to have_content("Answer all you know about Father Christmas")
|
404
|
+
expect(page).to have_content("Where does Father Christmas live?")
|
405
|
+
expect(page).to have_content("If you don't know where Father Christmas lives, skip the question")
|
406
|
+
expect(page).to have_content("Father Christmas lives on North Pole")
|
407
|
+
expect(page).to have_content("Father Christmas lives on South Pole")
|
408
|
+
expect(page).to have_content("Father Christmas doesn't exist")
|
409
|
+
expect(page).to have_content("Now think about reindeer")
|
410
|
+
expect(page).to have_content("Yes, reindeer")
|
411
|
+
end
|
412
|
+
end
|
413
|
+
context "versioning" do
|
414
|
+
include_context "favorites"
|
415
|
+
include_context "favorites-ish"
|
416
|
+
it "takes current survey" do
|
417
|
+
pending "only show one form for multiple versions"
|
418
|
+
response_set = start_survey('Favorites')
|
419
|
+
expect(page).to have_content("What is your favorite color?")
|
420
|
+
expect(page).to have_content("redish")
|
421
|
+
choose "blueish"
|
422
|
+
choose "redish"
|
423
|
+
click_button "Next section"
|
424
|
+
click_button "Click here to finish"
|
425
|
+
expect(response_set.count).to eq(1)
|
426
|
+
end
|
427
|
+
it "takes previous survey" do
|
428
|
+
pending "only show one form for multiple versions"
|
429
|
+
response_set = start_survey('Favorites', version: '0')
|
430
|
+
expect(page).to have_content("What is your favorite color?")
|
431
|
+
expect(page).to have_content("red")
|
432
|
+
choose "red"
|
433
|
+
choose "blue"
|
434
|
+
click_button "Next section"
|
435
|
+
click_button "Click here to finish"
|
436
|
+
expect(response_set.count).to eq(1)
|
437
|
+
end
|
438
|
+
end
|
439
|
+
context "shows responses" do
|
440
|
+
include_context "favorites"
|
441
|
+
include_context "feelings"
|
442
|
+
it "takes a survey, then shows it" do
|
443
|
+
response_set = start_survey('Favorites')
|
444
|
+
expect(page).to have_content("What is your favorite color?")
|
445
|
+
choose "red"
|
446
|
+
choose "blue"
|
447
|
+
check "orange"
|
448
|
+
check "brown"
|
449
|
+
click_button "Next section"
|
450
|
+
click_button "Click here to finish"
|
451
|
+
visit("/surveys/favorites/#{response_set.access_code}/")
|
452
|
+
expect(page).to have_disabled_selected_radio("blue")
|
453
|
+
expect(page).to have_disabled_selected_checkbox("orange")
|
454
|
+
expect(page).to have_disabled_selected_checkbox("brown")
|
455
|
+
end
|
456
|
+
it "takes a survey with grid questions, then shows it" do
|
457
|
+
response_set = start_survey('Feelings')
|
458
|
+
expect(page).to have_content("Tell us how you feel today")
|
459
|
+
within grid_row "anxious|calm" do
|
460
|
+
choose "-1"
|
461
|
+
end
|
462
|
+
click_button "Click here to finish"
|
463
|
+
visit("/surveys/favorites/#{response_set.access_code}/")
|
464
|
+
within grid_row "anxious|calm" do
|
465
|
+
expect(page).to have_disabled_selected_radio("-1")
|
466
|
+
end
|
467
|
+
end
|
468
|
+
end
|
469
|
+
end
|