helena 0.3.3 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -4
- data/Gemfile +1 -2
- data/Gemfile.lock +88 -95
- data/README.md +10 -25
- data/app/controllers/helena/application_controller.rb +0 -10
- data/app/controllers/helena/sessions_controller.rb +17 -6
- data/app/models/helena/answer.rb +1 -2
- data/app/models/helena/concerns/application_model.rb +0 -9
- data/app/models/helena/concerns/questions/validates_one_label.rb +1 -1
- data/app/models/helena/question.rb +5 -5
- data/app/models/helena/question_group.rb +4 -3
- data/app/models/helena/session.rb +27 -0
- data/app/models/helena/survey.rb +2 -7
- data/app/models/helena/version.rb +6 -4
- data/app/views/helena/questions/_static_text.html.slim +1 -0
- data/app/views/helena/sessions/_progressbar.html.slim +9 -0
- data/app/views/helena/sessions/edit.html.slim +18 -0
- data/app/views/helena/sessions/{end_message.html.haml → end_message.html.slim} +1 -1
- data/config/locales/models/question_group/en.yml +1 -0
- data/config/locales/models/session/en.yml +4 -0
- data/config/locales/models/survey/en.yml +3 -0
- data/config/locales/views/sessions/en.yml +4 -0
- data/config/routes.rb +1 -25
- data/db/seeds.rb +12 -140
- data/db/swls_survey.en.yml +67 -0
- data/helena.gemspec +1 -0
- data/lib/helena/engine.rb +11 -0
- data/lib/helena/survey_importer.rb +52 -0
- data/lib/helena/version.rb +1 -1
- data/lib/helena/version_publisher.rb +34 -2
- data/lib/helena.rb +3 -0
- data/spec/controllers/helena/sessions_controller_spec.rb +8 -3
- data/spec/dummy/app/controllers/application_controller.rb +0 -4
- data/spec/factories/helena/labels.rb +0 -1
- data/spec/factories/helena/question_groups.rb +0 -1
- data/spec/factories/helena/questions.rb +0 -1
- data/spec/factories/helena/sub_questions.rb +0 -1
- data/spec/factories/helena/surveys.rb +0 -1
- data/spec/features/helena/manage_session_spec.rb +76 -16
- data/spec/lib/survey_importer_spec.rb +14 -0
- data/spec/lib/version_publisher_spec.rb +5 -4
- data/spec/models/helena/answer_spec.rb +0 -1
- data/spec/models/helena/question_group_spec.rb +2 -1
- data/spec/models/helena/question_spec.rb +12 -4
- data/spec/models/helena/questions/checkbox_group_spec.rb +17 -0
- data/spec/models/helena/questions/radio_group_spec.rb +6 -0
- data/spec/models/helena/questions/radio_matrix_spec.rb +7 -0
- data/spec/models/helena/session_spec.rb +50 -0
- data/spec/models/helena/survey_spec.rb +12 -1
- data/spec/models/helena/version_spec.rb +11 -2
- metadata +26 -73
- data/app/assets/images/helena/icons/export.svg +0 -29
- data/app/assets/stylesheets/helena/admin/labels.css.sass +0 -7
- data/app/assets/stylesheets/helena/admin/layout.css.sass +0 -6
- data/app/assets/stylesheets/helena/admin/question_groups.css.sass +0 -7
- data/app/assets/stylesheets/helena/admin/questions.css.sass +0 -9
- data/app/assets/stylesheets/helena/admin/sessions.css.sass +0 -5
- data/app/assets/stylesheets/helena/admin/subquestions.css.sass +0 -7
- data/app/assets/stylesheets/helena/admin/versions.css.sass +0 -9
- data/app/controllers/helena/admin/application_controller.rb +0 -31
- data/app/controllers/helena/admin/question_groups_controller.rb +0 -78
- data/app/controllers/helena/admin/questions/checkbox_groups_controller.rb +0 -17
- data/app/controllers/helena/admin/questions/checkbox_matrix_controller.rb +0 -9
- data/app/controllers/helena/admin/questions/long_texts_controller.rb +0 -13
- data/app/controllers/helena/admin/questions/radio_groups_controller.rb +0 -17
- data/app/controllers/helena/admin/questions/radio_matrix_controller.rb +0 -9
- data/app/controllers/helena/admin/questions/short_texts_controller.rb +0 -13
- data/app/controllers/helena/admin/questions/static_texts_controller.rb +0 -13
- data/app/controllers/helena/admin/questions_controller.rb +0 -105
- data/app/controllers/helena/admin/sessions_controller.rb +0 -35
- data/app/controllers/helena/admin/surveys_controller.rb +0 -78
- data/app/controllers/helena/admin/versions_controller.rb +0 -71
- data/app/controllers/helena/surveys_controller.rb +0 -11
- data/app/views/helena/admin/question_groups/_form.html.haml +0 -3
- data/app/views/helena/admin/question_groups/edit.html.haml +0 -3
- data/app/views/helena/admin/question_groups/index.html.haml +0 -41
- data/app/views/helena/admin/question_groups/new.html.haml +0 -3
- data/app/views/helena/admin/questions/_form.html.haml +0 -15
- data/app/views/helena/admin/questions/_labels.html.haml +0 -24
- data/app/views/helena/admin/questions/_sub_questions.html.haml +0 -32
- data/app/views/helena/admin/questions/edit.html.haml +0 -3
- data/app/views/helena/admin/questions/index.html.haml +0 -49
- data/app/views/helena/admin/questions/new.html.haml +0 -3
- data/app/views/helena/admin/sessions/index.html.haml +0 -46
- data/app/views/helena/admin/surveys/_form.html.haml +0 -10
- data/app/views/helena/admin/surveys/edit.html.haml +0 -5
- data/app/views/helena/admin/surveys/index.html.haml +0 -35
- data/app/views/helena/admin/surveys/new.html.haml +0 -3
- data/app/views/helena/admin/versions/_form.html.haml +0 -5
- data/app/views/helena/admin/versions/default_session_report.html.haml +0 -17
- data/app/views/helena/admin/versions/edit.html.haml +0 -3
- data/app/views/helena/admin/versions/index.html.haml +0 -35
- data/app/views/helena/admin/versions/new.html.haml +0 -3
- data/app/views/helena/sessions/edit.html.haml +0 -16
- data/app/views/helena/surveys/_survey.html.haml +0 -3
- data/app/views/helena/surveys/index.html.haml +0 -2
- data/config/locales/views/admin/question_groups/en.yml +0 -12
- data/config/locales/views/admin/questions/en.yml +0 -16
- data/config/locales/views/admin/sessions/en.yml +0 -11
- data/config/locales/views/admin/surveys/en.yml +0 -10
- data/config/locales/views/admin/versions/en.yml +0 -8
- data/spec/controllers/helena/admin/question_group_controller_spec.rb +0 -59
- data/spec/controllers/helena/admin/questions_controller_spec.rb +0 -60
- data/spec/controllers/helena/admin/sessions_controller_spec.rb +0 -84
- data/spec/controllers/helena/admin/survey_controller_spec.rb +0 -89
- data/spec/controllers/helena/admin/versions_controller_spec.rb +0 -19
- data/spec/controllers/helena/application_controller_spec.rb +0 -15
- data/spec/features/helena/admin/manage_question_group_spec.rb +0 -101
- data/spec/features/helena/admin/manage_question_spec.rb +0 -105
- data/spec/features/helena/admin/manage_session_spec.rb +0 -40
- data/spec/features/helena/admin/manage_survey_spec.rb +0 -141
- data/spec/features/helena/admin/manage_version_spec.rb +0 -74
- data/spec/features/helena/admin/question_types/manage_checkbox_group_question_spec.rb +0 -55
- data/spec/features/helena/admin/question_types/manage_long_text_question_spec.rb +0 -21
- data/spec/features/helena/admin/question_types/manage_radio_group_question_spec.rb +0 -59
- data/spec/features/helena/admin/question_types/manage_radio_matrix_question_spec.rb +0 -80
- data/spec/features/helena/admin/question_types/manage_short_text_question_spec.rb +0 -19
- data/spec/features/helena/admin/question_types/manage_static_text_question_spec.rb +0 -17
- data/spec/features/helena/manage_survey_spec.rb +0 -24
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
feature 'Radio matrix question management' do
|
4
|
-
let!(:draft_version) { create :version, survey: create(:survey), version: 0 }
|
5
|
-
let!(:question_group) { create(:question_group, version: draft_version) }
|
6
|
-
|
7
|
-
scenario 'edits a question' do
|
8
|
-
question = create :radio_matrix_question, question_group: question_group
|
9
|
-
question.labels.create text: 'Strongly disagree', value: '-1', position: 1
|
10
|
-
question.sub_questions.create code: 'aperto', text: 'Aperto Snacks', value: 'Aperto', position: 1
|
11
|
-
|
12
|
-
visit helena.edit_admin_survey_question_group_question_path(draft_version.survey, question.question_group, question)
|
13
|
-
|
14
|
-
check 'Required'
|
15
|
-
|
16
|
-
fill_in 'questions_radio_matrix_labels_attributes_0_position', with: '2'
|
17
|
-
fill_in 'questions_radio_matrix_labels_attributes_0_text', with: 'Strongly agree'
|
18
|
-
fill_in 'questions_radio_matrix_labels_attributes_0_value', with: '1'
|
19
|
-
check 'questions_radio_matrix_labels_attributes_0_preselected'
|
20
|
-
|
21
|
-
fill_in 'questions_radio_matrix_sub_questions_attributes_0_position', with: '2'
|
22
|
-
fill_in 'questions_radio_matrix_sub_questions_attributes_0_text', with: 'Avec Shop'
|
23
|
-
fill_in 'questions_radio_matrix_sub_questions_attributes_0_code', with: 'avec'
|
24
|
-
|
25
|
-
click_button 'Save'
|
26
|
-
|
27
|
-
expect(question.reload.labels.first.position).to eq 2
|
28
|
-
expect(question.reload.labels.first.text).to eq 'Strongly agree'
|
29
|
-
expect(question.reload.labels.first.value).to eq '1'
|
30
|
-
expect(question.reload.labels.first.preselected).to eq true
|
31
|
-
|
32
|
-
expect(question.reload.sub_questions.first.position).to eq 2
|
33
|
-
expect(question.reload.sub_questions.first.text).to eq 'Avec Shop'
|
34
|
-
expect(question.reload.sub_questions.first.code).to eq 'avec'
|
35
|
-
|
36
|
-
expect(question.reload.required).to eq true
|
37
|
-
end
|
38
|
-
|
39
|
-
scenario 'adds a an option' do
|
40
|
-
question = create :radio_matrix_question, question_group: question_group
|
41
|
-
|
42
|
-
visit helena.edit_admin_survey_question_group_questions_radio_matrix_path(draft_version.survey, question.question_group, question)
|
43
|
-
|
44
|
-
fill_in 'questions_radio_matrix_labels_attributes_0_position', with: '2'
|
45
|
-
fill_in 'questions_radio_matrix_labels_attributes_0_text', with: 'Strongly agree'
|
46
|
-
fill_in 'questions_radio_matrix_labels_attributes_0_value', with: '1'
|
47
|
-
check 'questions_radio_matrix_labels_attributes_0_preselected'
|
48
|
-
|
49
|
-
fill_in 'questions_radio_matrix_sub_questions_attributes_0_position', with: '2'
|
50
|
-
fill_in 'questions_radio_matrix_sub_questions_attributes_0_text', with: 'Avec Shop'
|
51
|
-
fill_in 'questions_radio_matrix_sub_questions_attributes_0_code', with: 'avec'
|
52
|
-
|
53
|
-
click_button 'Save'
|
54
|
-
|
55
|
-
expect(question.reload.labels.first.position).to eq 2
|
56
|
-
expect(question.reload.labels.first.text).to eq 'Strongly agree'
|
57
|
-
expect(question.reload.labels.first.value).to eq '1'
|
58
|
-
expect(question.reload.labels.first.preselected).to eq true
|
59
|
-
|
60
|
-
expect(question.reload.sub_questions.first.position).to eq 2
|
61
|
-
expect(question.reload.sub_questions.first.text).to eq 'Avec Shop'
|
62
|
-
expect(question.reload.sub_questions.first.code).to eq 'avec'
|
63
|
-
end
|
64
|
-
|
65
|
-
scenario 'removes an option' do
|
66
|
-
question = create :radio_matrix_question, question_group: question_group
|
67
|
-
question.labels.create text: 'Male', value: 'm', position: 1
|
68
|
-
question.sub_questions.create code: 'aperto', text: 'Aperto Snacks', value: 'Aperto', position: 1
|
69
|
-
|
70
|
-
visit helena.edit_admin_survey_question_group_questions_radio_matrix_path(draft_version.survey, question.question_group, question)
|
71
|
-
|
72
|
-
check 'questions_radio_matrix_labels_attributes_0__destroy'
|
73
|
-
check 'questions_radio_matrix_sub_questions_attributes_0__destroy'
|
74
|
-
|
75
|
-
click_button 'Save'
|
76
|
-
|
77
|
-
expect(question.reload.labels).to be_empty
|
78
|
-
expect(question.reload.sub_questions).to be_empty
|
79
|
-
end
|
80
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
feature 'Short text question management' do
|
4
|
-
let!(:draft_version) { create :version, survey: create(:survey), version: 0 }
|
5
|
-
|
6
|
-
scenario 'edits a question' do
|
7
|
-
question = create :short_text_question, question_group: create(:question_group, version: draft_version)
|
8
|
-
|
9
|
-
visit helena.edit_admin_survey_question_group_question_path(question.question_group.version.survey, question.question_group, question)
|
10
|
-
|
11
|
-
fill_in 'Default value', with: 'Hey Hey!'
|
12
|
-
check 'Required'
|
13
|
-
|
14
|
-
click_button 'Save'
|
15
|
-
|
16
|
-
expect(question.reload.default_value).to eq 'Hey Hey!'
|
17
|
-
expect(question.reload.required).to eq true
|
18
|
-
end
|
19
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
feature 'Static text question management' do
|
4
|
-
let!(:draft_version) { create :version, survey: create(:survey), version: 0 }
|
5
|
-
|
6
|
-
scenario 'edits a question' do
|
7
|
-
question = create :static_text_question, question_group: create(:question_group, version: draft_version)
|
8
|
-
|
9
|
-
visit helena.edit_admin_survey_question_group_question_path(draft_version.survey, question.question_group, question)
|
10
|
-
|
11
|
-
fill_in 'Static text', with: 'This text will be displayed instead of an input'
|
12
|
-
|
13
|
-
click_button 'Save'
|
14
|
-
|
15
|
-
expect(question.reload.default_value).to eq 'This text will be displayed instead of an input'
|
16
|
-
end
|
17
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
feature 'Survey management' do
|
4
|
-
scenario 'lists all surveys' do
|
5
|
-
first_survey = create :survey, name: 'first'
|
6
|
-
first_survey.versions.create version: 0
|
7
|
-
first_survey.versions.first.survey_detail = Helena::SurveyDetail.new(title: 'My first survey', description: 'I am very proud of it')
|
8
|
-
second_survey = create :survey, name: 'second'
|
9
|
-
second_survey.versions.create version: 0
|
10
|
-
second_survey.versions.first.survey_detail = Helena::SurveyDetail.new(title: 'Another cool survey', description: 'Everybody likes it')
|
11
|
-
|
12
|
-
visit helena.surveys_path
|
13
|
-
|
14
|
-
within "#helena_#{dom_id first_survey}" do
|
15
|
-
expect(page).to have_text 'My first survey'
|
16
|
-
expect(page).to have_text 'I am very proud of it'
|
17
|
-
end
|
18
|
-
|
19
|
-
within "#helena_#{dom_id second_survey}" do
|
20
|
-
expect(page).to have_text 'Another cool survey'
|
21
|
-
expect(page).to have_text 'Everybody likes it'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|