moodle2cc 0.2.29 → 0.2.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moodle2cc/canvas/assessment.rb +0 -0
- data/lib/moodle2cc/canvas/assignment.rb +0 -0
- data/lib/moodle2cc/canvas/converter.rb +0 -0
- data/lib/moodle2cc/canvas/course.rb +0 -0
- data/lib/moodle2cc/canvas/discussion_topic.rb +0 -0
- data/lib/moodle2cc/canvas/label.rb +0 -0
- data/lib/moodle2cc/canvas/question_bank.rb +0 -0
- data/lib/moodle2cc/canvas/question_group.rb +0 -0
- data/lib/moodle2cc/canvas/resource.rb +0 -0
- data/lib/moodle2cc/canvas/templates/assignment.html.erb +0 -0
- data/lib/moodle2cc/canvas/templates/syllabus.html.erb +0 -0
- data/lib/moodle2cc/canvas/templates/wiki_content.html.erb +0 -0
- data/lib/moodle2cc/canvas/web_content.rb +0 -0
- data/lib/moodle2cc/canvas/web_link.rb +0 -0
- data/lib/moodle2cc/canvas/wiki.rb +0 -0
- data/lib/moodle2cc/cc/assessment.rb +0 -0
- data/lib/moodle2cc/cc/assignment.rb +0 -0
- data/lib/moodle2cc/cc/course.rb +0 -0
- data/lib/moodle2cc/cc/discussion_topic.rb +0 -0
- data/lib/moodle2cc/cc/label.rb +0 -0
- data/lib/moodle2cc/cc/question.rb +0 -0
- data/lib/moodle2cc/cc/resource.rb +0 -0
- data/lib/moodle2cc/cc/templates/assignment.html.erb +0 -0
- data/lib/moodle2cc/cc/templates/syllabus.html.erb +0 -0
- data/lib/moodle2cc/cc/templates/wiki_content.html.erb +0 -0
- data/lib/moodle2cc/cc/web_link.rb +0 -0
- data/lib/moodle2cc/cc/wiki.rb +0 -0
- data/lib/moodle2cc/error.rb +0 -0
- data/lib/moodle2cc/logger.rb +0 -0
- data/lib/moodle2cc/moodle/course.rb +0 -0
- data/lib/moodle2cc/moodle/grade_item.rb +0 -0
- data/lib/moodle2cc/moodle/info.rb +0 -0
- data/lib/moodle2cc/moodle/question_category.rb +0 -0
- data/lib/moodle2cc/moodle/section.rb +0 -0
- data/lib/moodle2cc/version.rb +1 -1
- metadata +4 -834
- data/.gitignore +0 -20
- data/.travis.yml +0 -8
- data/Changelog +0 -158
- data/Gemfile +0 -6
- data/Guardfile +0 -20
- data/LICENSE +0 -661
- data/README.md +0 -112
- data/moodle2cc.gemspec +0 -35
- data/spec/moodle2cc/canvas_cc/assessment_writer_spec.rb +0 -95
- data/spec/moodle2cc/canvas_cc/assignment_writer_spec.rb +0 -74
- data/spec/moodle2cc/canvas_cc/calculated_question_writer_spec.rb +0 -88
- data/spec/moodle2cc/canvas_cc/canvas_export_writer_spec.rb +0 -26
- data/spec/moodle2cc/canvas_cc/cartridge_creator_spec.rb +0 -50
- data/spec/moodle2cc/canvas_cc/course_setting_writer_spec.rb +0 -47
- data/spec/moodle2cc/canvas_cc/discussion_writer_spec.rb +0 -40
- data/spec/moodle2cc/canvas_cc/essay_question_writer_spec.rb +0 -31
- data/spec/moodle2cc/canvas_cc/file_meta_writer_spec.rb +0 -57
- data/spec/moodle2cc/canvas_cc/ims_manifest_generator_spec.rb +0 -141
- data/spec/moodle2cc/canvas_cc/matching_question_writer_spec.rb +0 -51
- data/spec/moodle2cc/canvas_cc/models/assessment_spec.rb +0 -131
- data/spec/moodle2cc/canvas_cc/models/assignment_spec.rb +0 -45
- data/spec/moodle2cc/canvas_cc/models/calculated_question_spec.rb +0 -25
- data/spec/moodle2cc/canvas_cc/models/canvas_file_spec.rb +0 -23
- data/spec/moodle2cc/canvas_cc/models/canvas_module_spec.rb +0 -16
- data/spec/moodle2cc/canvas_cc/models/course_spec.rb +0 -43
- data/spec/moodle2cc/canvas_cc/models/discussion_spec.rb +0 -47
- data/spec/moodle2cc/canvas_cc/models/discussion_topic_spec.rb +0 -7
- data/spec/moodle2cc/canvas_cc/models/module_item_spec.rb +0 -15
- data/spec/moodle2cc/canvas_cc/models/page_spec.rb +0 -36
- data/spec/moodle2cc/canvas_cc/models/question_spec.rb +0 -8
- data/spec/moodle2cc/canvas_cc/models/resource_spec.rb +0 -17
- data/spec/moodle2cc/canvas_cc/models/web_content_spec.rb +0 -7
- data/spec/moodle2cc/canvas_cc/models/web_link_spec.rb +0 -9
- data/spec/moodle2cc/canvas_cc/module_meta_writer_spec.rb +0 -118
- data/spec/moodle2cc/canvas_cc/multiple_answers_question_writer_spec.rb +0 -50
- data/spec/moodle2cc/canvas_cc/multiple_blanks_question_writer_spec.rb +0 -77
- data/spec/moodle2cc/canvas_cc/multiple_choice_question_writer_spec.rb +0 -69
- data/spec/moodle2cc/canvas_cc/multiple_dropdowns_question_writer_spec.rb +0 -46
- data/spec/moodle2cc/canvas_cc/numerical_question_writer_spec.rb +0 -69
- data/spec/moodle2cc/canvas_cc/page_writer_spec.rb +0 -30
- data/spec/moodle2cc/canvas_cc/question_bank_writer_spec.rb +0 -43
- data/spec/moodle2cc/canvas_cc/question_writer_spec.rb +0 -129
- data/spec/moodle2cc/canvas_cc/short_answer_question_writer_spec.rb +0 -50
- data/spec/moodle2cc/canvas_cc/text_only_question_writer_spec.rb +0 -23
- data/spec/moodle2cc/canvas_cc/true_false_question_writer_spec.rb +0 -62
- data/spec/moodle2cc/moodle2/extractor_spec.rb +0 -215
- data/spec/moodle2cc/moodle2/models/assignment_spec.rb +0 -36
- data/spec/moodle2cc/moodle2/models/book_chapter_spec.rb +0 -11
- data/spec/moodle2cc/moodle2/models/book_spec.rb +0 -13
- data/spec/moodle2cc/moodle2/models/course_spec.rb +0 -68
- data/spec/moodle2cc/moodle2/models/external_url_spec.rb +0 -18
- data/spec/moodle2cc/moodle2/models/folder_spec.rb +0 -16
- data/spec/moodle2cc/moodle2/models/forum_spec.rb +0 -30
- data/spec/moodle2cc/moodle2/models/glossary_entry_spec.rb +0 -25
- data/spec/moodle2cc/moodle2/models/glossary_spec.rb +0 -35
- data/spec/moodle2cc/moodle2/models/label_spec.rb +0 -84
- data/spec/moodle2cc/moodle2/models/moodle2_file_spec.rb +0 -32
- data/spec/moodle2cc/moodle2/models/page_spec.rb +0 -23
- data/spec/moodle2cc/moodle2/models/quizzes/answer_spec.rb +0 -14
- data/spec/moodle2cc/moodle2/models/quizzes/calculated_question_spec.rb +0 -14
- data/spec/moodle2cc/moodle2/models/quizzes/multianswer_question_spec.rb +0 -30
- data/spec/moodle2cc/moodle2/models/quizzes/numerical_question_spec.rb +0 -12
- data/spec/moodle2cc/moodle2/models/quizzes/question_category_spec.rb +0 -29
- data/spec/moodle2cc/moodle2/models/quizzes/question_spec.rb +0 -35
- data/spec/moodle2cc/moodle2/models/quizzes/quiz_spec.rb +0 -7
- data/spec/moodle2cc/moodle2/models/quizzes/random_sa_question_spec.rb +0 -12
- data/spec/moodle2cc/moodle2/models/quizzes/true_false_question_spec.rb +0 -16
- data/spec/moodle2cc/moodle2/models/resource_spec.rb +0 -22
- data/spec/moodle2cc/moodle2/models/section_spec.rb +0 -57
- data/spec/moodle2cc/moodle2/parsers/answer_parser_spec.rb +0 -18
- data/spec/moodle2cc/moodle2/parsers/assignment_parser_spec.rb +0 -44
- data/spec/moodle2cc/moodle2/parsers/book_parser_spec.rb +0 -35
- data/spec/moodle2cc/moodle2/parsers/choice_parser_spec.rb +0 -32
- data/spec/moodle2cc/moodle2/parsers/course_parser_spec.rb +0 -19
- data/spec/moodle2cc/moodle2/parsers/external_url_parser_spec.rb +0 -26
- data/spec/moodle2cc/moodle2/parsers/feedback_parser_spec.rb +0 -33
- data/spec/moodle2cc/moodle2/parsers/file_parser_spec.rb +0 -35
- data/spec/moodle2cc/moodle2/parsers/folder_parser_spec.rb +0 -24
- data/spec/moodle2cc/moodle2/parsers/forum_parser_spec.rb +0 -38
- data/spec/moodle2cc/moodle2/parsers/glossary_parser_spec.rb +0 -60
- data/spec/moodle2cc/moodle2/parsers/label_parser_spec.rb +0 -21
- data/spec/moodle2cc/moodle2/parsers/lti_parser_spec.rb +0 -21
- data/spec/moodle2cc/moodle2/parsers/page_parser_spec.rb +0 -25
- data/spec/moodle2cc/moodle2/parsers/parser_helper_spec.rb +0 -104
- data/spec/moodle2cc/moodle2/parsers/question_category_parser_spec.rb +0 -27
- data/spec/moodle2cc/moodle2/parsers/question_parsers/calculated_parser_spec.rb +0 -100
- data/spec/moodle2cc/moodle2/parsers/question_parsers/match_parser_spec.rb +0 -31
- data/spec/moodle2cc/moodle2/parsers/question_parsers/multianswer_parser_spec.rb +0 -16
- data/spec/moodle2cc/moodle2/parsers/question_parsers/multichoice_parser_spec.rb +0 -16
- data/spec/moodle2cc/moodle2/parsers/question_parsers/numerical_parser_spec.rb +0 -23
- data/spec/moodle2cc/moodle2/parsers/question_parsers/question_parser_spec.rb +0 -62
- data/spec/moodle2cc/moodle2/parsers/question_parsers/random_sa_parser_spec.rb +0 -18
- data/spec/moodle2cc/moodle2/parsers/question_parsers/short_answer_parser_spec.rb +0 -16
- data/spec/moodle2cc/moodle2/parsers/question_parsers/true_false_parser_spec.rb +0 -22
- data/spec/moodle2cc/moodle2/parsers/questionnaire_parser_spec.rb +0 -36
- data/spec/moodle2cc/moodle2/parsers/quiz_parser_spec.rb +0 -68
- data/spec/moodle2cc/moodle2/parsers/resource_parser_spec.rb +0 -29
- data/spec/moodle2cc/moodle2/parsers/section_parser_spec.rb +0 -27
- data/spec/moodle2cc/moodle2/parsers/wiki_parser_spec.rb +0 -23
- data/spec/moodle2cc/moodle2converter/assessment_converter_spec.rb +0 -209
- data/spec/moodle2cc/moodle2converter/assignment_converter_spec.rb +0 -47
- data/spec/moodle2cc/moodle2converter/book_converter_spec.rb +0 -132
- data/spec/moodle2cc/moodle2converter/converter_helper_spec.rb +0 -178
- data/spec/moodle2cc/moodle2converter/course_converter_spec.rb +0 -24
- data/spec/moodle2cc/moodle2converter/discussion_converter_spec.rb +0 -28
- data/spec/moodle2cc/moodle2converter/file_converter_spec.rb +0 -20
- data/spec/moodle2cc/moodle2converter/folder_converter_spec.rb +0 -44
- data/spec/moodle2cc/moodle2converter/glossary_converter_spec.rb +0 -35
- data/spec/moodle2cc/moodle2converter/html_converter_spec.rb +0 -191
- data/spec/moodle2cc/moodle2converter/label_converter_spec.rb +0 -100
- data/spec/moodle2cc/moodle2converter/migrator_spec.rb +0 -258
- data/spec/moodle2cc/moodle2converter/page_converter_spec.rb +0 -28
- data/spec/moodle2cc/moodle2converter/question_bank_converter_spec.rb +0 -61
- data/spec/moodle2cc/moodle2converter/question_converters/calculated_converter_spec.rb +0 -32
- data/spec/moodle2cc/moodle2converter/question_converters/matching_converter_spec.rb +0 -24
- data/spec/moodle2cc/moodle2converter/question_converters/multichoice_converter_spec.rb +0 -26
- data/spec/moodle2cc/moodle2converter/question_converters/multiple_blanks_converter_spec.rb +0 -37
- data/spec/moodle2cc/moodle2converter/question_converters/numerical_converter_spec.rb +0 -19
- data/spec/moodle2cc/moodle2converter/question_converters/question_converter_spec.rb +0 -81
- data/spec/moodle2cc/moodle2converter/question_converters/random_sa_converter_spec.rb +0 -20
- data/spec/moodle2cc/moodle2converter/question_converters/true_false_converter_spec.rb +0 -25
- data/spec/moodle2cc/moodle2converter/section_converter_spec.rb +0 -211
- data/spec/moodle2cc/moodle2converter/wiki_converter_spec.rb +0 -36
- data/spec/spec_helper.rb +0 -17
- data/spec/support/shared_examples_for_models.rb +0 -26
- data/test/acceptance/migrator_test.rb +0 -24
- data/test/fixtures/cc.imscc +0 -0
- data/test/fixtures/common_cartridge/ims_manifest_simple.xml +0 -45
- data/test/fixtures/common_cartridge/schema/cccv1p0.xsd +0 -563
- data/test/fixtures/common_cartridge/schema/ccv1p1_imsccauth_v1p1.xsd +0 -203
- data/test/fixtures/common_cartridge/schema/ccv1p1_imscp_v1p2_v1p0.xsd +0 -827
- data/test/fixtures/common_cartridge/schema/ccv1p1_lommanifest_v1p0.xsd +0 -822
- data/test/fixtures/common_cartridge/schema/ccv1p1_lomresource_v1p0.xsd +0 -273
- data/test/fixtures/common_cartridge/schema/xml.xsd +0 -286
- data/test/fixtures/moodle2/SC.mbz +0 -0
- data/test/fixtures/moodle2/backup/activities/assign_12/assign.xml +0 -78
- data/test/fixtures/moodle2/backup/activities/assign_12/calendar.xml +0 -21
- data/test/fixtures/moodle2/backup/activities/assign_12/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/assign_12/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/assign_12/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/assign_12/grades.xml +0 -38
- data/test/fixtures/moodle2/backup/activities/assign_12/grading.xml +0 -9
- data/test/fixtures/moodle2/backup/activities/assign_12/inforef.xml +0 -13
- data/test/fixtures/moodle2/backup/activities/assign_12/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/assign_12/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/assign_4/assign.xml +0 -78
- data/test/fixtures/moodle2/backup/activities/assign_4/calendar.xml +0 -21
- data/test/fixtures/moodle2/backup/activities/assign_4/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/assign_4/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/assign_4/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/assign_4/grades.xml +0 -38
- data/test/fixtures/moodle2/backup/activities/assign_4/grading.xml +0 -9
- data/test/fixtures/moodle2/backup/activities/assign_4/inforef.xml +0 -13
- data/test/fixtures/moodle2/backup/activities/assign_4/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/assign_4/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/assignment_42/assignment.xml +0 -28
- data/test/fixtures/moodle2/backup/activities/assignment_42/calendar.xml +0 -21
- data/test/fixtures/moodle2/backup/activities/assignment_42/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/assignment_42/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/assignment_42/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/assignment_42/grades.xml +0 -38
- data/test/fixtures/moodle2/backup/activities/assignment_42/grading.xml +0 -9
- data/test/fixtures/moodle2/backup/activities/assignment_42/inforef.xml +0 -13
- data/test/fixtures/moodle2/backup/activities/assignment_42/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/assignment_42/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/book_6/book.xml +0 -44
- data/test/fixtures/moodle2/backup/activities/book_6/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/book_6/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/book_6/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/book_6/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/book_6/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/book_6/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/book_6/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/book_6/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/choice_56547/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/choice_56547/choice.xml +0 -32
- data/test/fixtures/moodle2/backup/activities/choice_56547/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/choice_56547/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/choice_56547/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/choice_56547/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/choice_56547/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/choice_56547/module.xml +0 -28
- data/test/fixtures/moodle2/backup/activities/choice_56547/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/feedback_58588/feedback.xml +0 -147
- data/test/fixtures/moodle2/backup/activities/feedback_58588/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/feedback_58588/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/feedback_58588/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/feedback_58588/module.xml +0 -28
- data/test/fixtures/moodle2/backup/activities/feedback_58588/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/feedback_58589/feedback.xml +0 -147
- data/test/fixtures/moodle2/backup/activities/feedback_58589/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/feedback_58589/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/feedback_58589/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/feedback_58589/module.xml +0 -28
- data/test/fixtures/moodle2/backup/activities/feedback_58589/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/folder_7/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/folder_7/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/folder_7/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/folder_7/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/folder_7/folder.xml +0 -10
- data/test/fixtures/moodle2/backup/activities/folder_7/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/folder_7/inforef.xml +0 -20
- data/test/fixtures/moodle2/backup/activities/folder_7/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/folder_7/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/forum_13/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/forum_13/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/forum_13/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/forum_13/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/forum_13/forum.xml +0 -34
- data/test/fixtures/moodle2/backup/activities/forum_13/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/forum_13/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/forum_13/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/forum_13/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/glossary_8/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/glossary_8/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/glossary_8/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/glossary_8/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/glossary_8/glossary.xml +0 -115
- data/test/fixtures/moodle2/backup/activities/glossary_8/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/glossary_8/inforef.xml +0 -22
- data/test/fixtures/moodle2/backup/activities/glossary_8/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/glossary_8/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/grades.xml +0 -10
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/hsuforum.xml +0 -34
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/hsuforum_1/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/label_11/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/label_11/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/label_11/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/label_11/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/label_11/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/label_11/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/label_11/label.xml +0 -9
- data/test/fixtures/moodle2/backup/activities/label_11/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/label_11/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/lti_78841/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/lti_78841/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/lti_78841/grade_history.xml +0 -5
- data/test/fixtures/moodle2/backup/activities/lti_78841/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/lti_78841/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/lti_78841/lti.xml +0 -26
- data/test/fixtures/moodle2/backup/activities/lti_78841/module.xml +0 -20
- data/test/fixtures/moodle2/backup/activities/lti_78841/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/page_10/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_10/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_10/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_10/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/page_10/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/page_10/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_10/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/page_10/page.xml +0 -16
- data/test/fixtures/moodle2/backup/activities/page_10/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/page_2/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_2/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_2/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/page_2/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/page_2/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/page_2/inforef.xml +0 -14
- data/test/fixtures/moodle2/backup/activities/page_2/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/page_2/page.xml +0 -21
- data/test/fixtures/moodle2/backup/activities/page_2/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/questionnaire.xml +0 -245
- data/test/fixtures/moodle2/backup/activities/questionnaire_9/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/quiz_5/calendar.xml +0 -21
- data/test/fixtures/moodle2/backup/activities/quiz_5/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/quiz_5/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/quiz_5/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/quiz_5/grades.xml +0 -38
- data/test/fixtures/moodle2/backup/activities/quiz_5/inforef.xml +0 -21
- data/test/fixtures/moodle2/backup/activities/quiz_5/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/quiz_5/quiz.xml +0 -108
- data/test/fixtures/moodle2/backup/activities/quiz_5/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/resource_14/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/resource_14/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/resource_14/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/resource_14/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/resource_14/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/resource_14/inforef.xml +0 -11
- data/test/fixtures/moodle2/backup/activities/resource_14/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/resource_14/resource.xml +0 -16
- data/test/fixtures/moodle2/backup/activities/resource_14/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/resource_3/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/resource_3/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/resource_3/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/resource_3/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/resource_3/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/resource_3/inforef.xml +0 -11
- data/test/fixtures/moodle2/backup/activities/resource_3/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/resource_3/resource.xml +0 -16
- data/test/fixtures/moodle2/backup/activities/resource_3/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/url_15/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/url_15/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/url_15/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/url_15/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/url_15/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/url_15/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/url_15/module.xml +0 -25
- data/test/fixtures/moodle2/backup/activities/url_15/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/url_15/url.xml +0 -13
- data/test/fixtures/moodle2/backup/activities/wiki_58541/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/wiki_58541/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/activities/wiki_58541/grades.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/wiki_58541/inforef.xml +0 -47
- data/test/fixtures/moodle2/backup/activities/wiki_58541/module.xml +0 -28
- data/test/fixtures/moodle2/backup/activities/wiki_58541/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/activities/wiki_58541/wiki.xml +0 -70
- data/test/fixtures/moodle2/backup/completion.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/calendar_upcoming_12/block.xml +0 -13
- data/test/fixtures/moodle2/backup/course/blocks/calendar_upcoming_12/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/calendar_upcoming_12/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/calendar_upcoming_12/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/course/blocks/news_items_11/block.xml +0 -13
- data/test/fixtures/moodle2/backup/course/blocks/news_items_11/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/news_items_11/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/news_items_11/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/course/blocks/recent_activity_13/block.xml +0 -13
- data/test/fixtures/moodle2/backup/course/blocks/recent_activity_13/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/recent_activity_13/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/recent_activity_13/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/course/blocks/search_forums_10/block.xml +0 -13
- data/test/fixtures/moodle2/backup/course/blocks/search_forums_10/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/search_forums_10/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/course/blocks/search_forums_10/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/course/calendar.xml +0 -3
- data/test/fixtures/moodle2/backup/course/comments.xml +0 -3
- data/test/fixtures/moodle2/backup/course/course.xml +0 -37
- data/test/fixtures/moodle2/backup/course/enrolments.xml +0 -110
- data/test/fixtures/moodle2/backup/course/filters.xml +0 -7
- data/test/fixtures/moodle2/backup/course/inforef.xml +0 -13
- data/test/fixtures/moodle2/backup/course/roles.xml +0 -7
- data/test/fixtures/moodle2/backup/files.xml +0 -531
- data/test/fixtures/moodle2/backup/files/50/50bf82ee23d193378b172d6656c08eebb094f006 +0 -0
- data/test/fixtures/moodle2/backup/files/51/516ec993971b6e2122b97d15ecc0e08c3eb03828 +0 -0
- data/test/fixtures/moodle2/backup/files/64/64643b3bd4274c90e293583030e549e61f4d24fb +0 -0
- data/test/fixtures/moodle2/backup/files/67/67859b142e5ba020a84c3166f09d59ef992379a4 +0 -0
- data/test/fixtures/moodle2/backup/files/7a/7a647918739d3017a4e272ad97b147b667c00fca +0 -0
- data/test/fixtures/moodle2/backup/files/a0/a0f324310c8d8dd9c79458986c4322f5a060a1d9 +0 -0
- data/test/fixtures/moodle2/backup/files/a2/a258f0bb582d111a994b35fdc84a71ed1d487310 +0 -0
- data/test/fixtures/moodle2/backup/gradebook.xml +0 -57
- data/test/fixtures/moodle2/backup/groups.xml +0 -5
- data/test/fixtures/moodle2/backup/moodle_backup.xml +0 -572
- data/test/fixtures/moodle2/backup/outcomes.xml +0 -3
- data/test/fixtures/moodle2/backup/questions.xml +0 -1187
- data/test/fixtures/moodle2/backup/roles.xml +0 -11
- data/test/fixtures/moodle2/backup/scales.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_1/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_1/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_10/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_10/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_2/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_2/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_3/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_3/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_4/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_4/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_5/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_5/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_6/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_6/section.xml +0 -13
- data/test/fixtures/moodle2/backup/sections/section_7/inforef.xml +0 -3
- data/test/fixtures/moodle2/backup/sections/section_7/section.xml +0 -13
- data/test/fixtures/moodle2/backup/users.xml +0 -104
- data/test/fixtures/moodle2/moodle2_shell.mbz +0 -0
- data/test/fixtures/moodle_backup/course_files/folder/test.txt +0 -1
- data/test/fixtures/moodle_backup/course_files/test.txt +0 -1
- data/test/fixtures/moodle_backup/moodle.xml +0 -950
- data/test/fixtures/moodle_backup_random_questions/course_files/folder/test.txt +0 -1
- data/test/fixtures/moodle_backup_random_questions/course_files/test.txt +0 -1
- data/test/fixtures/moodle_backup_random_questions/moodle.xml +0 -357
- data/test/test_helper.rb +0 -71
- data/test/test_question_helper.rb +0 -122
- data/test/test_wiki_helper.rb +0 -21
- data/test/unit/canvas/assessment_test.rb +0 -261
- data/test/unit/canvas/assignment_test.rb +0 -220
- data/test/unit/canvas/converter_test.rb +0 -171
- data/test/unit/canvas/course_test.rb +0 -176
- data/test/unit/canvas/discussion_topic_test.rb +0 -129
- data/test/unit/canvas/label_test.rb +0 -32
- data/test/unit/canvas/question_bank_test.rb +0 -92
- data/test/unit/canvas/question_group_test.rb +0 -90
- data/test/unit/canvas/question_test.rb +0 -876
- data/test/unit/canvas/web_content_test.rb +0 -46
- data/test/unit/canvas/web_link_test.rb +0 -48
- data/test/unit/canvas/wiki_test.rb +0 -74
- data/test/unit/cc/assessment_test.rb +0 -48
- data/test/unit/cc/assignment_test.rb +0 -72
- data/test/unit/cc/cc_helper_test.rb +0 -19
- data/test/unit/cc/converter_test.rb +0 -173
- data/test/unit/cc/course_test.rb +0 -36
- data/test/unit/cc/discussion_topic_test.rb +0 -83
- data/test/unit/cc/label_test.rb +0 -29
- data/test/unit/cc/question_test.rb +0 -54
- data/test/unit/cc/web_content_test.rb +0 -76
- data/test/unit/cc/web_link_test.rb +0 -159
- data/test/unit/cc/wiki_test.rb +0 -139
- data/test/unit/logger_test.rb +0 -33
- data/test/unit/migrator_test.rb +0 -67
- data/test/unit/moodle/backup_test.rb +0 -30
- data/test/unit/moodle/course_test.rb +0 -57
- data/test/unit/moodle/grade_item_test.rb +0 -72
- data/test/unit/moodle/info_test.rb +0 -21
- data/test/unit/moodle/mod_test.rb +0 -301
- data/test/unit/moodle/question_category_test.rb +0 -34
- data/test/unit/moodle/question_test.rb +0 -193
- data/test/unit/moodle/section_test.rb +0 -92
- data/test/unit/resource_factory_test.rb +0 -216
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'test_helper'
|
4
|
-
require 'moodle2cc'
|
5
|
-
|
6
|
-
class TestUnitCanvasLabel < MiniTest::Unit::TestCase
|
7
|
-
include TestHelper
|
8
|
-
|
9
|
-
def setup
|
10
|
-
convert_moodle_backup 'canvas'
|
11
|
-
@mod = @backup.course.mods.find { |m| m.mod_type == "label" }
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
clean_tmp_folder
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_it_creates_item_in_module_meta
|
19
|
-
label = Moodle2CC::Canvas::Label.new @mod
|
20
|
-
node = Builder::XmlMarkup.new
|
21
|
-
xml = Nokogiri::XML(label.create_module_meta_item_node(node, 5))
|
22
|
-
|
23
|
-
assert_equal 'item', xml.root.name
|
24
|
-
assert_equal 'ifcf0624ce811c812c749c53f3c914f20', xml.root.attributes['identifier'].value
|
25
|
-
assert_equal "Section 1", xml.root.xpath('title').text
|
26
|
-
assert_equal '5', xml.root.xpath('position').text
|
27
|
-
assert_equal '', xml.root.xpath('new_tab').text
|
28
|
-
assert_equal '1', xml.root.xpath('indent').text
|
29
|
-
assert_equal 'ContextModuleSubHeader', xml.root.xpath('content_type').text
|
30
|
-
refute xml.root.xpath('identifierref').first, 'label should not have identifierref'
|
31
|
-
end
|
32
|
-
end
|
@@ -1,92 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'test_helper'
|
4
|
-
require 'moodle2cc'
|
5
|
-
|
6
|
-
class TestUnitCanvasQuestionBank < MiniTest::Unit::TestCase
|
7
|
-
include TestHelper
|
8
|
-
|
9
|
-
def setup
|
10
|
-
convert_moodle_backup 'canvas'
|
11
|
-
@course = @backup.course
|
12
|
-
@question_category = @course.question_categories.first
|
13
|
-
end
|
14
|
-
|
15
|
-
def teardown
|
16
|
-
clean_tmp_folder
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_it_converts_id
|
20
|
-
@question_category.id = 121
|
21
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new @question_category
|
22
|
-
assert_equal 121, question_bank.id
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_it_converts_title
|
26
|
-
@question_category.name = 'Default for Beginning Ruby on Rails'
|
27
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new @question_category
|
28
|
-
assert_equal 'Default for Beginning Ruby on Rails', question_bank.title
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_it_converts_questions
|
32
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new @question_category
|
33
|
-
assert_equal 5, question_bank.questions.length
|
34
|
-
assert_kind_of Moodle2CC::Canvas::Question, question_bank.questions[0]
|
35
|
-
assert_kind_of Moodle2CC::Canvas::Question, question_bank.questions[1]
|
36
|
-
assert_kind_of Moodle2CC::Canvas::Question, question_bank.questions[2]
|
37
|
-
assert_kind_of Moodle2CC::Canvas::Question, question_bank.questions[3]
|
38
|
-
assert_kind_of Moodle2CC::Canvas::Question, question_bank.questions[4]
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_it_does_not_convert_random_questions
|
42
|
-
convert_moodle_backup('canvas', 'moodle_backup_random_questions')
|
43
|
-
mod = @backup.course.mods.find { |m| m.mod_type == "quiz" }
|
44
|
-
question_category = @backup.course.question_categories.first
|
45
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new question_category
|
46
|
-
|
47
|
-
assert_equal 2, question_bank.questions.length
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_it_has_an_identifier
|
51
|
-
@question_category.id = 121
|
52
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new @question_category
|
53
|
-
# objectbank_{id}
|
54
|
-
assert_equal 'i02849cd800255cc6c762cdafd8d8db67', question_bank.identifier
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_it_creates_resource_in_imsmanifest
|
58
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new @question_category
|
59
|
-
node = Builder::XmlMarkup.new
|
60
|
-
xml = Nokogiri::XML(question_bank.create_resource_node(node))
|
61
|
-
|
62
|
-
resource = xml.xpath('resource').first
|
63
|
-
assert resource
|
64
|
-
assert_equal 'associatedcontent/imscc_xmlv1p1/learning-application-resource', resource.attributes['type'].value
|
65
|
-
assert_equal 'non_cc_assessments/i02849cd800255cc6c762cdafd8d8db67.xml.qti', resource.attributes['href'].value
|
66
|
-
assert_equal 'i02849cd800255cc6c762cdafd8d8db67', resource.attributes['identifier'].value
|
67
|
-
|
68
|
-
file = resource.xpath('file[@href="non_cc_assessments/i02849cd800255cc6c762cdafd8d8db67.xml.qti"]').first
|
69
|
-
assert file
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_it_creates_qti_xml
|
73
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new @question_category
|
74
|
-
tmp_dir = File.expand_path('../../../tmp', __FILE__)
|
75
|
-
question_bank.create_qti_xml(tmp_dir)
|
76
|
-
xml = Nokogiri::XML(File.read(File.join(tmp_dir, 'non_cc_assessments', "i02849cd800255cc6c762cdafd8d8db67.xml.qti")))
|
77
|
-
|
78
|
-
assert xml
|
79
|
-
assert_equal "http://www.imsglobal.org/xsd/ims_qtiasiv1p2 http://www.imsglobal.org/xsd/ims_qtiasiv1p2p1.xsd", xml.root.attributes['schemaLocation'].value
|
80
|
-
assert_equal "http://www.w3.org/2001/XMLSchema-instance", xml.namespaces['xmlns:xsi']
|
81
|
-
assert_equal "http://www.imsglobal.org/xsd/ims_qtiasiv1p2", xml.namespaces['xmlns']
|
82
|
-
assert_equal 'questestinterop', xml.root.name
|
83
|
-
|
84
|
-
assert_equal 'i02849cd800255cc6c762cdafd8d8db67', xml.root.xpath('xmlns:objectbank').first.attributes['ident'].value
|
85
|
-
|
86
|
-
time_data = xml.root.xpath('xmlns:objectbank/xmlns:qtimetadata/xmlns:qtimetadatafield[xmlns:fieldlabel="bank_title" and xmlns:fieldentry="Default for Beginning Ruby on Rails"]').first
|
87
|
-
assert time_data, 'qtimetadata does not exist for time limit'
|
88
|
-
|
89
|
-
items = xml.root.xpath('xmlns:objectbank/xmlns:item')
|
90
|
-
assert_equal 5, items.length
|
91
|
-
end
|
92
|
-
end
|
@@ -1,90 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'test_helper'
|
4
|
-
require 'moodle2cc'
|
5
|
-
|
6
|
-
class TestUnitCanvasQuestionGroup < MiniTest::Unit::TestCase
|
7
|
-
include TestHelper
|
8
|
-
|
9
|
-
def setup
|
10
|
-
convert_moodle_backup 'canvas', 'moodle_backup_random_questions'
|
11
|
-
@course = @backup.course
|
12
|
-
end
|
13
|
-
|
14
|
-
def teardown
|
15
|
-
clean_tmp_folder
|
16
|
-
end
|
17
|
-
|
18
|
-
def test_it_has_an_id
|
19
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new :id => 1
|
20
|
-
assert_equal 1, question_group.id
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_it_has_an_id_that_defaults_to_1
|
24
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new
|
25
|
-
assert_equal 1, question_group.id
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_it_has_a_title_from_the_id
|
29
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new :id => 1
|
30
|
-
assert_equal 'Group 1', question_group.title
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_it_has_a_selection_number
|
34
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new
|
35
|
-
assert_equal 1, question_group.selection_number
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_it_can_increment_the_selection_number
|
39
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new
|
40
|
-
question_group.increment_selection_number
|
41
|
-
assert_equal 2, question_group.selection_number
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_it_has_points_per_item
|
45
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new :points_per_item => 2
|
46
|
-
assert_equal 2, question_group.points_per_item
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_it_has_points_per_item_that_defaults_to_1
|
50
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new
|
51
|
-
assert_equal 1, question_group.points_per_item
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_it_has_a_question_bank
|
55
|
-
question_category = @course.question_categories.first
|
56
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new question_category
|
57
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new :question_bank => question_bank
|
58
|
-
assert_equal question_bank, question_group.question_bank
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_it_has_a_sourcebank_ref
|
62
|
-
question_category = @course.question_categories.first
|
63
|
-
question_bank = Moodle2CC::Canvas::QuestionBank.new question_category
|
64
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new :question_bank => question_bank
|
65
|
-
assert_equal question_bank.identifier, question_group.sourcebank_ref
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_it_has_an_identifer_based_on_id
|
69
|
-
question_group = Moodle2CC::Canvas::QuestionGroup.new :id => 1
|
70
|
-
assert_equal 'i5432a6c714ced15aecdc0209411ecbe9', question_group.identifier
|
71
|
-
# question_group_1
|
72
|
-
end
|
73
|
-
|
74
|
-
def test_it_creates_item_xml
|
75
|
-
mod = @course.mods.find { |mod| mod.mod_type == 'quiz' }
|
76
|
-
assessment = Moodle2CC::Canvas::Assessment.new mod
|
77
|
-
question_group = assessment.questions.first
|
78
|
-
node = Builder::XmlMarkup.new
|
79
|
-
xml = Nokogiri::XML(question_group.create_item_xml(node))
|
80
|
-
|
81
|
-
assert xml.root, 'root element does not exist'
|
82
|
-
assert_equal 'section', xml.root.name
|
83
|
-
assert_equal 'Group 1', xml.root.attributes['title'].value
|
84
|
-
assert_equal 'i5432a6c714ced15aecdc0209411ecbe9', xml.root.attributes['ident'].value
|
85
|
-
|
86
|
-
assert_equal question_group.sourcebank_ref, xml.root.xpath('selection_ordering/selection/sourcebank_ref').text
|
87
|
-
assert_equal '2', xml.root.xpath('selection_ordering/selection/selection_number').text
|
88
|
-
assert_equal '1', xml.root.xpath('selection_ordering/selection/selection_extension/points_per_item').text
|
89
|
-
end
|
90
|
-
end
|
@@ -1,876 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
require 'minitest/autorun'
|
3
|
-
require 'test_helper'
|
4
|
-
require 'test_question_helper'
|
5
|
-
require 'moodle2cc'
|
6
|
-
|
7
|
-
class TestUnitCanvasQuestion < MiniTest::Unit::TestCase
|
8
|
-
include TestHelper
|
9
|
-
include TestQuestionHelper
|
10
|
-
|
11
|
-
def setup
|
12
|
-
convert_moodle_backup 'canvas'
|
13
|
-
@mod = @backup.course.mods.find { |mod| mod.mod_type == 'quiz' }
|
14
|
-
@question = @mod.questions.first
|
15
|
-
@question.image = nil
|
16
|
-
end
|
17
|
-
|
18
|
-
def teardown
|
19
|
-
clean_tmp_folder
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_it_inherits_from_cc
|
23
|
-
assert Moodle2CC::Canvas::Question.ancestors.include?(Moodle2CC::CC::Question), 'does not inherit from base CC class'
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_it_converts_length
|
27
|
-
@question.length = 5
|
28
|
-
question = Moodle2CC::Canvas::Question.new @question
|
29
|
-
assert_equal 5, question.length
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_it_converts_question_type
|
33
|
-
@question.type = 'calculated'
|
34
|
-
question = Moodle2CC::Canvas::Question.new @question
|
35
|
-
assert_equal 'calculated_question', question.question_type
|
36
|
-
|
37
|
-
@question.type = 'description'
|
38
|
-
question = Moodle2CC::Canvas::Question.new @question
|
39
|
-
assert_equal 'text_only_question', question.question_type
|
40
|
-
|
41
|
-
@question.type = 'essay'
|
42
|
-
question = Moodle2CC::Canvas::Question.new @question
|
43
|
-
assert_equal 'essay_question', question.question_type
|
44
|
-
|
45
|
-
@question.type = 'match'
|
46
|
-
question = Moodle2CC::Canvas::Question.new @question
|
47
|
-
assert_equal 'matching_question', question.question_type
|
48
|
-
|
49
|
-
@question.type = 'multianswer'
|
50
|
-
question = Moodle2CC::Canvas::Question.new @question
|
51
|
-
assert_equal 'embedded_answers_question', question.question_type
|
52
|
-
|
53
|
-
@question.type = 'multichoice'
|
54
|
-
question = Moodle2CC::Canvas::Question.new @question
|
55
|
-
assert_equal 'multiple_choice_question', question.question_type
|
56
|
-
|
57
|
-
@question.type = 'shortanswer'
|
58
|
-
question = Moodle2CC::Canvas::Question.new @question
|
59
|
-
assert_equal 'short_answer_question', question.question_type
|
60
|
-
|
61
|
-
@question.type = 'numerical'
|
62
|
-
question = Moodle2CC::Canvas::Question.new @question
|
63
|
-
assert_equal 'numerical_question', question.question_type
|
64
|
-
|
65
|
-
@question.type = 'truefalse'
|
66
|
-
question = Moodle2CC::Canvas::Question.new @question
|
67
|
-
assert_equal 'true_false_question', question.question_type
|
68
|
-
|
69
|
-
@question.type = nil
|
70
|
-
|
71
|
-
@question.type_id = 1
|
72
|
-
question = Moodle2CC::Canvas::Question.new @question
|
73
|
-
assert_equal 'true_false_question', question.question_type
|
74
|
-
|
75
|
-
@question.type_id = 2
|
76
|
-
question = Moodle2CC::Canvas::Question.new @question
|
77
|
-
assert_equal 'essay_question', question.question_type
|
78
|
-
|
79
|
-
@question.type_id = 3
|
80
|
-
question = Moodle2CC::Canvas::Question.new @question
|
81
|
-
assert_equal 'essay_question', question.question_type
|
82
|
-
|
83
|
-
@question.type_id = 4
|
84
|
-
question = Moodle2CC::Canvas::Question.new @question
|
85
|
-
assert_equal 'multiple_choice_question', question.question_type
|
86
|
-
|
87
|
-
@question.type_id = 5
|
88
|
-
question = Moodle2CC::Canvas::Question.new @question
|
89
|
-
assert_equal 'multiple_answers_question', question.question_type
|
90
|
-
|
91
|
-
@question.type_id = 6
|
92
|
-
question = Moodle2CC::Canvas::Question.new @question
|
93
|
-
assert_equal 'multiple_choice_question', question.question_type
|
94
|
-
|
95
|
-
@question.type_id = 8
|
96
|
-
question = Moodle2CC::Canvas::Question.new @question
|
97
|
-
assert_equal 'multiple_dropdowns_question', question.question_type
|
98
|
-
|
99
|
-
@question.type_id = 9
|
100
|
-
question = Moodle2CC::Canvas::Question.new @question
|
101
|
-
assert_equal 'essay_question', question.question_type
|
102
|
-
|
103
|
-
@question.type_id = 10
|
104
|
-
question = Moodle2CC::Canvas::Question.new @question
|
105
|
-
assert_equal 'numerical_question', question.question_type
|
106
|
-
|
107
|
-
@question.type_id = 100
|
108
|
-
question = Moodle2CC::Canvas::Question.new @question
|
109
|
-
assert_equal 'text_only_question', question.question_type
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_it_converts_points_possible
|
113
|
-
@question.grade = 5
|
114
|
-
question = Moodle2CC::Canvas::Question.new @question
|
115
|
-
assert_equal 5, question.points_possible
|
116
|
-
end
|
117
|
-
|
118
|
-
def test_it_converts_material
|
119
|
-
@question.text = "How much is {a} + {b} ?"
|
120
|
-
question = Moodle2CC::Canvas::Question.new @question
|
121
|
-
assert_equal "How much is [a] + [b] ?", question.material
|
122
|
-
end
|
123
|
-
|
124
|
-
def test_it_adds_image_tag_to_material
|
125
|
-
@question.text = "How much is {a} + {b} ?"
|
126
|
-
@question.image = "test.jpg"
|
127
|
-
question = Moodle2CC::Canvas::Question.new @question
|
128
|
-
assert_equal %{How much is [a] + [b] ?<p><img src="$IMS_CC_FILEBASE$/test.jpg" alt="test.jpg"/></p>}, question.material
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_it_converts_markdown_text_to_html_material
|
132
|
-
@question.text = "This is **bold** and this is _italic_"
|
133
|
-
@question.format = 4 # markdown
|
134
|
-
question = Moodle2CC::Canvas::Question.new @question
|
135
|
-
assert_equal "<p>This is <strong>bold</strong> and this is <em>italic</em></p>\n", question.material
|
136
|
-
end
|
137
|
-
|
138
|
-
def test_it_converts_material_for_multiple_dropdowns_question
|
139
|
-
multiple_dropdowns_question!
|
140
|
-
@question.content = "This is a rating question"
|
141
|
-
question = Moodle2CC::Canvas::Question.new @question
|
142
|
-
assert_equal "This is a rating question\nI test my code [response1]\nI am happy [response2]", question.material
|
143
|
-
end
|
144
|
-
|
145
|
-
def test_it_converts_material_for_multiple_dropdowns_question_without_choices
|
146
|
-
multiple_dropdowns_question_without_choices!
|
147
|
-
question = Moodle2CC::Canvas::Question.new @question
|
148
|
-
assert_equal "This is a rating question but not formatted very well\nthis isn't actually a choice [response1]\nso add the choices automatically [response2]", question.material
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_it_converts_general_feedback
|
152
|
-
@question.general_feedback = "This should be easy"
|
153
|
-
question = Moodle2CC::Canvas::Question.new @question
|
154
|
-
assert_equal "This should be easy", question.general_feedback
|
155
|
-
end
|
156
|
-
|
157
|
-
def test_it_converts_answer_tolerance
|
158
|
-
@question.calculations.first.tolerance = 0.01
|
159
|
-
question = Moodle2CC::Canvas::Question.new @question
|
160
|
-
assert_equal 0.01, question.answer_tolerance
|
161
|
-
end
|
162
|
-
|
163
|
-
def test_it_converts_formula_decimal_places
|
164
|
-
calculation = @question.calculations.first
|
165
|
-
calculation.correct_answer_format = 1 # decimal
|
166
|
-
calculation.correct_answer_length = 2
|
167
|
-
|
168
|
-
question = Moodle2CC::Canvas::Question.new @question
|
169
|
-
assert_equal 2, question.formula_decimal_places
|
170
|
-
|
171
|
-
calculation.correct_answer_format = 2 # significant figures
|
172
|
-
|
173
|
-
question = Moodle2CC::Canvas::Question.new @question
|
174
|
-
assert_equal 0, question.formula_decimal_places
|
175
|
-
end
|
176
|
-
|
177
|
-
def test_it_converts_formulas
|
178
|
-
answer1 = @question.answers.first
|
179
|
-
answer2 = answer1.dup
|
180
|
-
@question.answers << answer2
|
181
|
-
|
182
|
-
answer1.text = '{a} + {b}'
|
183
|
-
answer2.text = '{a} * {b}'
|
184
|
-
|
185
|
-
question = Moodle2CC::Canvas::Question.new @question
|
186
|
-
assert_equal 2, question.formulas.length
|
187
|
-
assert_equal 'a+b', question.formulas.first
|
188
|
-
assert_equal 'a*b', question.formulas.last
|
189
|
-
end
|
190
|
-
|
191
|
-
def test_it_converts_vars
|
192
|
-
calculation = @question.calculations.first
|
193
|
-
ds_def1 = calculation.dataset_definitions.first
|
194
|
-
ds_def2 = calculation.dataset_definitions.last
|
195
|
-
|
196
|
-
ds_def1.name = 'a'
|
197
|
-
ds_def1.options = 'uniform:3.0:9.0:3'
|
198
|
-
|
199
|
-
ds_def2.name = 'b'
|
200
|
-
ds_def2.options = 'uniform:1.0:10.0:1'
|
201
|
-
|
202
|
-
question = Moodle2CC::Canvas::Question.new @question
|
203
|
-
assert_equal 2, question.vars.length
|
204
|
-
assert_equal({:name => 'a', :scale => '3', :min => '3.0', :max => '9.0'}, question.vars.first)
|
205
|
-
assert_equal({:name => 'b', :scale => '1', :min => '1.0', :max => '10.0'}, question.vars.last)
|
206
|
-
end
|
207
|
-
|
208
|
-
def test_it_converts_var_sets
|
209
|
-
calculation = @question.calculations.first
|
210
|
-
ds_def1 = calculation.dataset_definitions.first
|
211
|
-
ds_def2 = calculation.dataset_definitions.last
|
212
|
-
|
213
|
-
ds_def1.name = 'a'
|
214
|
-
ds_item1 = ds_def1.dataset_items.first
|
215
|
-
ds_item2 = ds_item1.dup
|
216
|
-
ds_def1.dataset_items[1] = ds_item2
|
217
|
-
|
218
|
-
ds_item1.number = 1
|
219
|
-
ds_item1.value = 3.0
|
220
|
-
ds_item2.number = 2
|
221
|
-
ds_item2.value = 5.5
|
222
|
-
|
223
|
-
ds_def2.name = 'b'
|
224
|
-
ds_item1 = ds_def2.dataset_items.first
|
225
|
-
ds_item2 = ds_item1.dup
|
226
|
-
ds_def2.dataset_items[1] = ds_item2
|
227
|
-
|
228
|
-
ds_item1.number = 1
|
229
|
-
ds_item1.value = 6.0
|
230
|
-
ds_item2.number = 2
|
231
|
-
ds_item2.value = 1.0
|
232
|
-
|
233
|
-
question = Moodle2CC::Canvas::Question.new @question
|
234
|
-
assert_equal 2, question.var_sets.length
|
235
|
-
assert_equal({:vars => {'a' => 3.0, 'b' => 6.0}, :answer => 9.0}, question.var_sets.first)
|
236
|
-
assert_equal({:vars => {'a' => 5.5, 'b' => 1.0}, :answer => 6.5}, question.var_sets.last)
|
237
|
-
end
|
238
|
-
|
239
|
-
def test_it_converts_matches
|
240
|
-
match_question!
|
241
|
-
|
242
|
-
question = Moodle2CC::Canvas::Question.new @question
|
243
|
-
assert_equal 2, question.matches.length
|
244
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
245
|
-
:question => 'Ruby on Rails is written in this language',
|
246
|
-
:answers => {123 => 'Ruby', 234 => 'Python', 345 => 'CoffeeScript'},
|
247
|
-
:answer => 123
|
248
|
-
), question.matches.first)
|
249
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
250
|
-
:question => 'Files with .coffee extension use which language?',
|
251
|
-
:answers => {123 => 'Ruby', 234 => 'Python', 345 => 'CoffeeScript'},
|
252
|
-
:answer => 345
|
253
|
-
), question.matches.last)
|
254
|
-
end
|
255
|
-
|
256
|
-
def test_it_converts_numericals
|
257
|
-
answer = Moodle2CC::Moodle::Question::Answer.new
|
258
|
-
answer.id = 43
|
259
|
-
answer.text = "Blah"
|
260
|
-
numerical = Moodle2CC::Moodle::Question::Numerical.new
|
261
|
-
numerical.answer_id = 43
|
262
|
-
numerical.tolerance = 3
|
263
|
-
@question.numericals = [numerical]
|
264
|
-
@question.answers = [answer]
|
265
|
-
question = Moodle2CC::Canvas::Question.new @question
|
266
|
-
|
267
|
-
assert_equal 1, question.numericals.length
|
268
|
-
|
269
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
270
|
-
:answer => question.answers.first,
|
271
|
-
:tolerance => 3
|
272
|
-
), question.numericals.first)
|
273
|
-
end
|
274
|
-
|
275
|
-
def test_it_converts_answers
|
276
|
-
multiple_choice_question!
|
277
|
-
|
278
|
-
question = Moodle2CC::Canvas::Question.new @question
|
279
|
-
assert_equal 4, question.answers.length
|
280
|
-
|
281
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
282
|
-
:id => 123,
|
283
|
-
:text => 'Ruby',
|
284
|
-
:fraction => 1,
|
285
|
-
:feedback => 'Yippee!'
|
286
|
-
), question.answers[0])
|
287
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
288
|
-
:id => 234,
|
289
|
-
:text => 'CoffeeScript',
|
290
|
-
:fraction => 0.75,
|
291
|
-
:feedback => 'Nope'
|
292
|
-
), question.answers[1])
|
293
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
294
|
-
:id => 345,
|
295
|
-
:text => 'Java',
|
296
|
-
:fraction => 0.25,
|
297
|
-
:feedback => 'No way'
|
298
|
-
), question.answers[2])
|
299
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
300
|
-
:id => 456,
|
301
|
-
:text => 'Clojure',
|
302
|
-
:fraction => 0,
|
303
|
-
:feedback => 'Not even close'
|
304
|
-
), question.answers[3])
|
305
|
-
end
|
306
|
-
|
307
|
-
def test_it_converts_answers_from_questionnaire_choices
|
308
|
-
@question.type = nil
|
309
|
-
@question.type_id = 4
|
310
|
-
|
311
|
-
choice1 = Moodle2CC::Moodle::Question::Choice.new
|
312
|
-
choice1.id = 123
|
313
|
-
choice1.content = 'Ruby'
|
314
|
-
|
315
|
-
choice2 = Moodle2CC::Moodle::Question::Choice.new
|
316
|
-
choice2.id = 234
|
317
|
-
choice2.content = 'CoffeeScript'
|
318
|
-
|
319
|
-
choice3 = Moodle2CC::Moodle::Question::Choice.new
|
320
|
-
choice3.id = 345
|
321
|
-
choice3.content = 'Java'
|
322
|
-
|
323
|
-
choice4 = Moodle2CC::Moodle::Question::Choice.new
|
324
|
-
choice4.id = 456
|
325
|
-
choice4.content = 'Clojure'
|
326
|
-
|
327
|
-
@question.choices = [choice1, choice2, choice3, choice4]
|
328
|
-
@question.answers = []
|
329
|
-
|
330
|
-
question = Moodle2CC::Canvas::Question.new @question
|
331
|
-
assert_equal 4, question.answers.length
|
332
|
-
|
333
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
334
|
-
:id => 123,
|
335
|
-
:text => 'Ruby'
|
336
|
-
), question.answers[0])
|
337
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
338
|
-
:id => 234,
|
339
|
-
:text => 'CoffeeScript'
|
340
|
-
), question.answers[1])
|
341
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
342
|
-
:id => 345,
|
343
|
-
:text => 'Java'
|
344
|
-
), question.answers[2])
|
345
|
-
assert_equal(Moodle2CC::OpenStruct.new(
|
346
|
-
:id => 456,
|
347
|
-
:text => 'Clojure'
|
348
|
-
), question.answers[3])
|
349
|
-
end
|
350
|
-
|
351
|
-
def test_it_has_an_identifier_based_on_id
|
352
|
-
@question.id = 989
|
353
|
-
@question.instance_id = nil
|
354
|
-
question = Moodle2CC::Canvas::Question.new @question
|
355
|
-
assert_equal 'i04823ed56ffd4fd5f9c21db0cf25be6c', question.identifier
|
356
|
-
# question_989
|
357
|
-
end
|
358
|
-
|
359
|
-
def test_it_has_an_identifier_based_on_instance_id
|
360
|
-
@question.instance_id = 787
|
361
|
-
question = Moodle2CC::Canvas::Question.new @question
|
362
|
-
assert_equal 'i2edcb021d100c968ba3f570253a6aa1c', question.identifier
|
363
|
-
# question_instance_787
|
364
|
-
end
|
365
|
-
|
366
|
-
def test_it_has_an_assessment_question_identifierref_if_instance_id_exists
|
367
|
-
@question.id = 989
|
368
|
-
@question.instance_id = 787
|
369
|
-
question = Moodle2CC::Canvas::Question.new @question
|
370
|
-
assert_equal 'i04823ed56ffd4fd5f9c21db0cf25be6c', question.assessment_question_identifierref
|
371
|
-
# question_989
|
372
|
-
end
|
373
|
-
|
374
|
-
def test_it_does_not_have_an_assessment_question_identifierref_if_instance_id_does_not_exist
|
375
|
-
@question.id = 989
|
376
|
-
@question.instance_id = nil
|
377
|
-
question = Moodle2CC::Canvas::Question.new @question
|
378
|
-
refute question.assessment_question_identifierref
|
379
|
-
# question_989
|
380
|
-
end
|
381
|
-
|
382
|
-
def test_it_creates_fractions
|
383
|
-
question = Moodle2CC::Canvas::Question.new @question
|
384
|
-
assert_equal 100, question.get_score(1)
|
385
|
-
assert_equal 50, question.get_score(0.5)
|
386
|
-
assert_equal 0, question.get_score(0)
|
387
|
-
assert_equal 100, question.get_score(nil)
|
388
|
-
end
|
389
|
-
|
390
|
-
def test_it_create_multple_question_from_choice_mod
|
391
|
-
@choice_mod = @backup.course.mods.find { |m| m.mod_type == 'choice' }
|
392
|
-
question = Moodle2CC::Canvas::Question.new @choice_mod.questions.first
|
393
|
-
|
394
|
-
assert_equal 'multiple_choice_question', question.question_type
|
395
|
-
end
|
396
|
-
|
397
|
-
def test_it_creates_item_xml
|
398
|
-
@question.image = 'test.jpg'
|
399
|
-
question = Moodle2CC::Canvas::Question.new @question
|
400
|
-
node = Builder::XmlMarkup.new
|
401
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
402
|
-
|
403
|
-
assert xml.root
|
404
|
-
assert_equal 'item', xml.root.name
|
405
|
-
assert_equal 'Basic Arithmetic', xml.root.attributes['title'].value
|
406
|
-
assert_equal 'i7cf4483ef2da120de20ff6cfc9dd3e58', xml.root.attributes['ident'].value
|
407
|
-
|
408
|
-
assert xml.root.xpath('itemmetadata/qtimetadata/qtimetadatafield[fieldlabel="question_type" and fieldentry="calculated_question"]').first, 'does not have meta data for question type'
|
409
|
-
assert xml.root.xpath('itemmetadata/qtimetadata/qtimetadatafield[fieldlabel="points_possible" and fieldentry="1"]').first, 'does not have meta data for points possible'
|
410
|
-
assert xml.root.xpath('itemmetadata/qtimetadata/qtimetadatafield[fieldlabel="assessment_question_identifierref" and fieldentry="i04823ed56ffd4fd5f9c21db0cf25be6c"]').first, 'does not have meta data for assessment_question_identifierref'
|
411
|
-
|
412
|
-
assert_equal %{How much is [a] + [b] ?<p><img src="$IMS_CC_FILEBASE$/test.jpg" alt="test.jpg"/></p>}, xml.root.xpath('presentation/material/mattext[@texttype="text/html"]').text
|
413
|
-
|
414
|
-
# Score
|
415
|
-
outcome = xml.root.xpath('resprocessing/outcomes/decvar').first
|
416
|
-
assert_equal '100', outcome.attributes['maxvalue'].value
|
417
|
-
assert_equal '0', outcome.attributes['minvalue'].value
|
418
|
-
assert_equal 'SCORE', outcome.attributes['varname'].value
|
419
|
-
assert_equal 'Decimal', outcome.attributes['vartype'].value
|
420
|
-
|
421
|
-
# General Feedback
|
422
|
-
general_feedback = xml.root.xpath('resprocessing/respcondition[1]').first
|
423
|
-
assert_equal 'Yes', general_feedback.attributes['continue'].value
|
424
|
-
assert general_feedback.xpath('conditionvar/other').first, 'does not contain conditionvar'
|
425
|
-
assert_equal 'Response', general_feedback.xpath('displayfeedback').first.attributes['feedbacktype'].value
|
426
|
-
assert_equal 'general_fb', general_feedback.xpath('displayfeedback').first.attributes['linkrefid'].value
|
427
|
-
|
428
|
-
general_feedback = xml.root.xpath('itemfeedback[@ident="general_fb"]').first
|
429
|
-
assert general_feedback, 'no feeback node'
|
430
|
-
material = general_feedback.xpath('flow_mat/material/mattext[@texttype="text/html"]').first
|
431
|
-
assert material, 'no feedback text'
|
432
|
-
assert_equal 'This should be easy', material.text
|
433
|
-
end
|
434
|
-
|
435
|
-
def test_it_creates_item_xml_for_calculated_question
|
436
|
-
@question.type = 'calculated'
|
437
|
-
question = Moodle2CC::Canvas::Question.new @question
|
438
|
-
node = Builder::XmlMarkup.new
|
439
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
440
|
-
|
441
|
-
response = xml.root.xpath('presentation/response_str').first
|
442
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
443
|
-
assert_equal 'response1', response.attributes['ident'].value
|
444
|
-
assert_equal 'Decimal', response.xpath('render_fib').first.attributes['fibtype'].value
|
445
|
-
assert_equal 'answer1', response.xpath('render_fib/response_label').first.attributes['ident'].value
|
446
|
-
|
447
|
-
# Correct Condition
|
448
|
-
condition = xml.root.xpath('resprocessing/respcondition[@title="correct"]').first
|
449
|
-
assert condition, 'correct condition node does not exist'
|
450
|
-
assert condition.xpath('conditionvar/other').first, 'conditionvar does not exist for correct condition node'
|
451
|
-
setvar = condition.xpath('setvar').first
|
452
|
-
assert setvar, 'setvar does not exist for correct condition node'
|
453
|
-
assert_equal 'SCORE', setvar.attributes['varname'].value
|
454
|
-
assert_equal 'Set', setvar.attributes['action'].value
|
455
|
-
assert_equal '100', setvar.text
|
456
|
-
|
457
|
-
# Incorrect Condition
|
458
|
-
condition = xml.root.xpath('resprocessing/respcondition[@title="incorrect"]').first
|
459
|
-
assert condition, 'incorrect condition node does not exist'
|
460
|
-
assert condition.xpath('conditionvar/other').first, 'conditionvar does not exist for incorrect condition node'
|
461
|
-
setvar = condition.xpath('setvar').first
|
462
|
-
assert setvar, 'setvar does not exist for incorrect condition node'
|
463
|
-
assert_equal 'SCORE', setvar.attributes['varname'].value
|
464
|
-
assert_equal 'Set', setvar.attributes['action'].value
|
465
|
-
assert_equal '0', setvar.text
|
466
|
-
|
467
|
-
# Calculations
|
468
|
-
calculated = xml.root.xpath('itemproc_extension/calculated').first
|
469
|
-
assert calculated, 'calculated node does not exist'
|
470
|
-
assert_equal '0.01', calculated.xpath('answer_tolerance').text
|
471
|
-
|
472
|
-
# Formulas
|
473
|
-
assert calculated.xpath('formulas[@decimal_places="2"]').first, 'calculated node does not contain formulas with decimal_places'
|
474
|
-
assert calculated.xpath('formulas/formula["a+b"]').first, 'calculated node does not contain the formula a+b'
|
475
|
-
|
476
|
-
# Var
|
477
|
-
a_var = calculated.xpath('vars/var[@scale="1"][@name="a"]').first
|
478
|
-
assert a_var, 'calculated node does not have variable for a'
|
479
|
-
assert_equal '1.0', a_var.xpath('min').text
|
480
|
-
assert_equal '10.0', a_var.xpath('max').text
|
481
|
-
b_var = calculated.xpath('vars/var[@scale="1"][@name="b"]').first
|
482
|
-
assert b_var, 'calculated node does not have variable for b'
|
483
|
-
assert_equal '1.0', b_var.xpath('min').text
|
484
|
-
assert_equal '10.0', b_var.xpath('max').text
|
485
|
-
|
486
|
-
# Var Sets
|
487
|
-
var_set1 = calculated.xpath('var_sets/var_set[1]').first
|
488
|
-
assert var_set1, 'first var_set does not exist'
|
489
|
-
assert_equal '3060', var_set1.attributes['ident'].value
|
490
|
-
assert var_set1.xpath('var[@name="a"][3.0]'), 'first var_set does not have a value for a'
|
491
|
-
assert var_set1.xpath('var[@name="b"][6.0]'), 'first var_set does not have a value for b'
|
492
|
-
assert var_set1.xpath('answer[9.0]'), 'first var_set does not have an answer'
|
493
|
-
|
494
|
-
var_set2 = calculated.xpath('var_sets/var_set[2]').first
|
495
|
-
assert var_set2, 'second var_set does not exist'
|
496
|
-
assert_equal '5510', var_set2.attributes['ident'].value
|
497
|
-
assert var_set2.xpath('var[@name="a"][5.5]'), 'second var_set does not have a value for a'
|
498
|
-
assert var_set2.xpath('var[@name="b"][1.0]'), 'second var_set does not have a value for b'
|
499
|
-
assert var_set2.xpath('answer[6.5]'), 'second var_set does not have an answer'
|
500
|
-
end
|
501
|
-
|
502
|
-
def test_it_creates_item_xml_for_essay_question
|
503
|
-
@question.type = 'essay'
|
504
|
-
question = Moodle2CC::Canvas::Question.new @question
|
505
|
-
node = Builder::XmlMarkup.new
|
506
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
507
|
-
|
508
|
-
response = xml.root.xpath('presentation/response_str').first
|
509
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
510
|
-
assert_equal 'response1', response.attributes['ident'].value
|
511
|
-
assert_equal 'No', response.xpath('render_fib/response_label').first.attributes['rshuffle'].value
|
512
|
-
assert_equal 'answer1', response.xpath('render_fib/response_label').first.attributes['ident'].value
|
513
|
-
|
514
|
-
# No Continue Condition
|
515
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]').first
|
516
|
-
assert condition, 'no continue condition node does not exist'
|
517
|
-
assert condition.xpath('conditionvar/other').first, 'conditionvar does not exist for no continue condition node'
|
518
|
-
end
|
519
|
-
|
520
|
-
def test_it_creates_item_xml_for_matching_question
|
521
|
-
match_question!
|
522
|
-
|
523
|
-
question = Moodle2CC::Canvas::Question.new @question
|
524
|
-
node = Builder::XmlMarkup.new
|
525
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
526
|
-
|
527
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response_123"]').first
|
528
|
-
assert response, 'response for first matching question does not exist'
|
529
|
-
assert_equal 'Ruby on Rails is written in this language', response.xpath('material/mattext[@texttype="text/html"]').text
|
530
|
-
assert_equal 'Ruby', response.xpath('render_choice/response_label[@ident="123"]/material/mattext').text
|
531
|
-
assert_equal 'Python', response.xpath('render_choice/response_label[@ident="234"]/material/mattext').text
|
532
|
-
assert_equal 'CoffeeScript', response.xpath('render_choice/response_label[@ident="345"]/material/mattext').text
|
533
|
-
|
534
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response_345"]').first
|
535
|
-
assert response, 'response for second matching question does not exist'
|
536
|
-
assert_equal 'Files with .coffee extension use which language?', response.xpath('material/mattext[@texttype="text/html"]').text
|
537
|
-
assert_equal 'Ruby', response.xpath('render_choice/response_label[@ident="123"]/material/mattext').text
|
538
|
-
assert_equal 'Python', response.xpath('render_choice/response_label[@ident="234"]/material/mattext').text
|
539
|
-
assert_equal 'CoffeeScript', response.xpath('render_choice/response_label[@ident="345"]/material/mattext').text
|
540
|
-
|
541
|
-
condition = xml.root.xpath('resprocessing/respcondition/conditionvar[varequal=123]/..').first
|
542
|
-
assert condition, 'first matching condition does not exist'
|
543
|
-
assert condition.xpath('conditionvar/varequal[@respident="response_123"]').first, 'condition does not reference correct response'
|
544
|
-
set_var = condition.xpath('setvar').first
|
545
|
-
assert_equal 'SCORE', set_var.attributes['varname'].value
|
546
|
-
assert_equal 'Add', set_var.attributes['action'].value
|
547
|
-
assert_equal '50.00', set_var.text
|
548
|
-
|
549
|
-
condition = xml.root.xpath('resprocessing/respcondition/conditionvar[varequal=345]/..').first
|
550
|
-
assert condition, 'second matching condition does not exist'
|
551
|
-
assert condition.xpath('conditionvar/varequal[@respident="response_345"]').first, 'condition does not reference correct response'
|
552
|
-
set_var = condition.xpath('setvar').first
|
553
|
-
assert_equal 'SCORE', set_var.attributes['varname'].value
|
554
|
-
assert_equal 'Add', set_var.attributes['action'].value
|
555
|
-
assert_equal '50.00', set_var.text
|
556
|
-
end
|
557
|
-
|
558
|
-
def test_it_creates_item_xml_for_multiple_choice_question
|
559
|
-
multiple_choice_question!
|
560
|
-
|
561
|
-
question = Moodle2CC::Canvas::Question.new @question
|
562
|
-
node = Builder::XmlMarkup.new
|
563
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
564
|
-
|
565
|
-
# Responses
|
566
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response1"]').first
|
567
|
-
assert response, 'response for multiple choice question does not exist'
|
568
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
569
|
-
assert_equal 'Ruby', response.xpath('render_choice/response_label[@ident="123"]/material/mattext[@texttype="text/html"]').text
|
570
|
-
assert_equal 'CoffeeScript', response.xpath('render_choice/response_label[@ident="234"]/material/mattext[@texttype="text/html"]').text
|
571
|
-
assert_equal 'Java', response.xpath('render_choice/response_label[@ident="345"]/material/mattext[@texttype="text/html"]').text
|
572
|
-
assert_equal 'Clojure', response.xpath('render_choice/response_label[@ident="456"]/material/mattext[@texttype="text/html"]').text
|
573
|
-
|
574
|
-
# Feedback
|
575
|
-
feedback = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="123"]/../..').first
|
576
|
-
assert feedback, 'feedback does not exist for first answer'
|
577
|
-
display = feedback.xpath('displayfeedback[@feedbacktype="Response"][@linkrefid="123_fb"]').first
|
578
|
-
assert display, 'display feedback does not exist for first answer'
|
579
|
-
|
580
|
-
feedback = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="234"]/../..').first
|
581
|
-
assert feedback, 'feedback does not exist for second answer'
|
582
|
-
display = feedback.xpath('displayfeedback[@feedbacktype="Response"][@linkrefid="234_fb"]').first
|
583
|
-
assert display, 'display feedback does not exist for second answer'
|
584
|
-
|
585
|
-
feedback = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="345"]/../..').first
|
586
|
-
assert feedback, 'feedback does not exist for third answer'
|
587
|
-
display = feedback.xpath('displayfeedback[@feedbacktype="Response"][@linkrefid="345_fb"]').first
|
588
|
-
assert display, 'display feedback does not exist for third answer'
|
589
|
-
|
590
|
-
feedback = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="456"]/../..').first
|
591
|
-
assert feedback, 'feedback does not exist for fourth answer'
|
592
|
-
display = feedback.xpath('displayfeedback[@feedbacktype="Response"][@linkrefid="456_fb"]').first
|
593
|
-
assert display, 'display feedback does not exist for fourth answer'
|
594
|
-
|
595
|
-
feedback = xml.root.xpath('itemfeedback[@ident="123_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
596
|
-
assert feedback, 'feedback text does not exist for first answer'
|
597
|
-
assert_equal 'Yippee!', feedback.text
|
598
|
-
|
599
|
-
feedback = xml.root.xpath('itemfeedback[@ident="234_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
600
|
-
assert feedback, 'feedback text does not exist for second answer'
|
601
|
-
assert_equal 'Nope', feedback.text
|
602
|
-
|
603
|
-
feedback = xml.root.xpath('itemfeedback[@ident="345_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
604
|
-
assert feedback, 'feedback text does not exist for third answer'
|
605
|
-
assert_equal 'No way', feedback.text
|
606
|
-
|
607
|
-
feedback = xml.root.xpath('itemfeedback[@ident="456_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
608
|
-
assert feedback, 'feedback text does not exist for fourth answer'
|
609
|
-
assert_equal 'Not even close', feedback.text
|
610
|
-
|
611
|
-
# Conditions
|
612
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="123"]/../..').first
|
613
|
-
assert condition, 'condition does not exist for first answer'
|
614
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="100"]').first
|
615
|
-
assert var, 'score does not exist for first answer'
|
616
|
-
|
617
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="234"]/../..').first
|
618
|
-
assert condition, 'condition does not exist for first answer'
|
619
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="75"]').first
|
620
|
-
assert var, 'score does not exist for second answer'
|
621
|
-
|
622
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="345"]/../..').first
|
623
|
-
assert condition, 'condition does not exist for first answer'
|
624
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="25"]').first
|
625
|
-
assert var, 'score does not exist for third answer'
|
626
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="456"]/../..').first
|
627
|
-
|
628
|
-
assert condition, 'condition does not exist for first answer'
|
629
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="0"]').first
|
630
|
-
assert var, 'score does not exist for fourth answer'
|
631
|
-
end
|
632
|
-
|
633
|
-
def test_it_creates_item_xml_for_multiple_dropdowns_question
|
634
|
-
multiple_dropdowns_question!
|
635
|
-
|
636
|
-
question = Moodle2CC::Canvas::Question.new @question
|
637
|
-
node = Builder::XmlMarkup.new
|
638
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
639
|
-
|
640
|
-
# Responses
|
641
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response_response1"]').first
|
642
|
-
assert response, 'first response for multiple dropdowns question does not exist'
|
643
|
-
assert response.xpath('material/mattext["response1"]').first, 'material text does not exist for multiple dropdowns question first response'
|
644
|
-
assert_equal '1=Almost Never', response.xpath('render_choice/response_label[@ident="11"]/material/mattext[@texttype="text/html"]').text
|
645
|
-
assert_equal '2=Sometimes', response.xpath('render_choice/response_label[@ident="12"]/material/mattext[@texttype="text/html"]').text
|
646
|
-
assert_equal '3=Always', response.xpath('render_choice/response_label[@ident="13"]/material/mattext[@texttype="text/html"]').text
|
647
|
-
refute response.xpath('render_choice/response_label[4]').first, 'there should not be a response for answer text'
|
648
|
-
refute response.xpath('render_choice/response_label[5]').first, 'there should not be a response for answer text'
|
649
|
-
|
650
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response_response2"]').first
|
651
|
-
assert response, 'second response for multiple dropdowns question does not exist'
|
652
|
-
assert response.xpath('material/mattext["response2"]').first, 'material text does not exist for multiple dropdowns question second response'
|
653
|
-
assert_equal '1=Almost Never', response.xpath('render_choice/response_label[@ident="21"]/material/mattext[@texttype="text/html"]').text
|
654
|
-
assert_equal '2=Sometimes', response.xpath('render_choice/response_label[@ident="22"]/material/mattext[@texttype="text/html"]').text
|
655
|
-
assert_equal '3=Always', response.xpath('render_choice/response_label[@ident="23"]/material/mattext[@texttype="text/html"]').text
|
656
|
-
refute response.xpath('render_choice/response_label[4]').first, 'there should not be a response for answer text'
|
657
|
-
refute response.xpath('render_choice/response_label[5]').first, 'there should not be a response for answer text'
|
658
|
-
|
659
|
-
# Conditions
|
660
|
-
condition = xml.root.xpath('resprocessing/respcondition/conditionvar/varequal[@respident="response_response1" and text()="11"]/../..').first
|
661
|
-
assert condition, 'condition does not exist for first answer'
|
662
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Add" and text()="50.00"]').first
|
663
|
-
assert var, 'score does not exist for first answer'
|
664
|
-
|
665
|
-
condition = xml.root.xpath('resprocessing/respcondition/conditionvar/varequal[@respident="response_response2" and text()="21"]/../..').first
|
666
|
-
assert condition, 'condition does not exist for first answer'
|
667
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Add" and text()="50.00"]').first
|
668
|
-
assert var, 'score does not exist for second answer'
|
669
|
-
end
|
670
|
-
|
671
|
-
def test_it_creates_item_xml_for_multiple_dropdowns_question_without_choices
|
672
|
-
multiple_dropdowns_question_without_choices!
|
673
|
-
|
674
|
-
question = Moodle2CC::Canvas::Question.new @question
|
675
|
-
node = Builder::XmlMarkup.new
|
676
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
677
|
-
|
678
|
-
# Responses
|
679
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response_response1"]').first
|
680
|
-
assert response, 'first response for multiple dropdowns question does not exist'
|
681
|
-
assert response.xpath('material/mattext["response1"]').first, 'material text does not exist for multiple dropdowns question first response'
|
682
|
-
assert_equal '1', response.xpath('render_choice/response_label[@ident="11"]/material/mattext[@texttype="text/html"]').text
|
683
|
-
assert_equal '2', response.xpath('render_choice/response_label[@ident="12"]/material/mattext[@texttype="text/html"]').text
|
684
|
-
assert_equal '3', response.xpath('render_choice/response_label[@ident="13"]/material/mattext[@texttype="text/html"]').text
|
685
|
-
refute response.xpath('render_choice/response_label[4]').first, 'there should not be a response for answer text'
|
686
|
-
refute response.xpath('render_choice/response_label[5]').first, 'there should not be a response for answer text'
|
687
|
-
|
688
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response_response2"]').first
|
689
|
-
assert response, 'second response for multiple dropdowns question does not exist'
|
690
|
-
assert response.xpath('material/mattext["response2"]').first, 'material text does not exist for multiple dropdowns question second response'
|
691
|
-
assert_equal '1', response.xpath('render_choice/response_label[@ident="21"]/material/mattext[@texttype="text/html"]').text
|
692
|
-
assert_equal '2', response.xpath('render_choice/response_label[@ident="22"]/material/mattext[@texttype="text/html"]').text
|
693
|
-
assert_equal '3', response.xpath('render_choice/response_label[@ident="23"]/material/mattext[@texttype="text/html"]').text
|
694
|
-
refute response.xpath('render_choice/response_label[4]').first, 'there should not be a response for answer text'
|
695
|
-
refute response.xpath('render_choice/response_label[5]').first, 'there should not be a response for answer text'
|
696
|
-
|
697
|
-
# Conditions
|
698
|
-
condition = xml.root.xpath('resprocessing/respcondition/conditionvar/varequal[@respident="response_response1" and text()="11"]/../..').first
|
699
|
-
assert condition, 'condition does not exist for first answer'
|
700
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Add" and text()="50.00"]').first
|
701
|
-
assert var, 'score does not exist for first answer'
|
702
|
-
|
703
|
-
condition = xml.root.xpath('resprocessing/respcondition/conditionvar/varequal[@respident="response_response2" and text()="21"]/../..').first
|
704
|
-
assert condition, 'condition does not exist for first answer'
|
705
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Add" and text()="50.00"]').first
|
706
|
-
assert var, 'score does not exist for second answer'
|
707
|
-
end
|
708
|
-
|
709
|
-
def test_it_create_item_xml_for_multiple_answers_question
|
710
|
-
multiple_answers_question!
|
711
|
-
|
712
|
-
question = Moodle2CC::Canvas::Question.new @question
|
713
|
-
node = Builder::XmlMarkup.new
|
714
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
715
|
-
|
716
|
-
# Responses
|
717
|
-
response = xml.root.xpath('presentation/response_lid[@ident="response1" and @rcardinality="Multiple"]').first
|
718
|
-
assert response, 'response for multiple answers question does not exist'
|
719
|
-
assert_equal 'Ruby', response.xpath('render_choice/response_label[@ident="1"]/material/mattext[@texttype="text/html"]').text
|
720
|
-
assert_equal 'Javascript', response.xpath('render_choice/response_label[@ident="2"]/material/mattext[@texttype="text/html"]').text
|
721
|
-
assert_equal 'Python', response.xpath('render_choice/response_label[@ident="3"]/material/mattext[@texttype="text/html"]').text
|
722
|
-
|
723
|
-
# Conditions
|
724
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]').first
|
725
|
-
assert condition, 'condition does not exist for multiple answer question'
|
726
|
-
var = condition.xpath('conditionvar/and/varequal[@respident="response1" and text()="1"]').first
|
727
|
-
assert var, 'varequal does not exist for first answer'
|
728
|
-
var = condition.xpath('conditionvar/and/not/varequal[@respident="response1" and text()="2"]').first
|
729
|
-
assert var, 'varequal does not exist for second answer'
|
730
|
-
var = condition.xpath('conditionvar/and/not/varequal[@respident="response1" and text()="3"]').first
|
731
|
-
assert var, 'varequal does not exist for third answer'
|
732
|
-
var = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="100"]').first
|
733
|
-
assert var, 'score does not exist for first answer'
|
734
|
-
end
|
735
|
-
|
736
|
-
def test_it_creates_item_xml_for_numerical_question
|
737
|
-
numerical_question!
|
738
|
-
|
739
|
-
question = Moodle2CC::Canvas::Question.new @question
|
740
|
-
node = Builder::XmlMarkup.new
|
741
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
742
|
-
|
743
|
-
response = xml.root.xpath('presentation/response_str').first
|
744
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
745
|
-
assert_equal 'response1', response.attributes['ident'].value
|
746
|
-
assert_equal 'Decimal', response.xpath('render_fib').first.attributes['fibtype'].value
|
747
|
-
assert_equal 'answer1', response.xpath('render_fib/response_label').first.attributes['ident'].value
|
748
|
-
|
749
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"][1]').first
|
750
|
-
assert condition, 'condition does not exist for first answer'
|
751
|
-
var = condition.xpath('conditionvar/or/varequal[@respident="response1" and text()="28"]').first
|
752
|
-
assert var, 'conditionvar varequal does not exist for first answer'
|
753
|
-
var = condition.xpath('conditionvar/or/and/vargte[@respident="response1" and text()="26.0"]').first
|
754
|
-
assert var, 'conditionvar vargte does not exist for first answer'
|
755
|
-
var = condition.xpath('conditionvar/or/and/varlte[@respident="response1" and text()="30.0"]').first
|
756
|
-
assert var, 'conditionvar varlte does not exist for first answer'
|
757
|
-
setvar = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="100"]').first
|
758
|
-
assert setvar, 'setvar does not exist for first answer'
|
759
|
-
feedback = condition.xpath('displayfeedback[@feedbacktype="Response" and @linkrefid="43_fb"]').first
|
760
|
-
assert feedback, 'displayfeedback does not exist for first answer'
|
761
|
-
|
762
|
-
feedback = xml.root.xpath('itemfeedback[@ident="43_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
763
|
-
assert feedback, 'feedback text does not exist for first answer'
|
764
|
-
assert_equal 'Great age!', feedback.text
|
765
|
-
end
|
766
|
-
|
767
|
-
|
768
|
-
def test_it_creates_item_xml_for_short_answer_question
|
769
|
-
short_answer_question!
|
770
|
-
|
771
|
-
question = Moodle2CC::Canvas::Question.new @question
|
772
|
-
node = Builder::XmlMarkup.new
|
773
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
774
|
-
|
775
|
-
response = xml.root.xpath('presentation/response_str').first
|
776
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
777
|
-
assert_equal 'response1', response.attributes['ident'].value
|
778
|
-
assert_equal 'No', response.xpath('render_fib/response_label').first.attributes['rshuffle'].value
|
779
|
-
assert_equal 'answer1', response.xpath('render_fib/response_label').first.attributes['ident'].value
|
780
|
-
|
781
|
-
# Conditions
|
782
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="Ruby"]/../..').first
|
783
|
-
assert condition, 'condition does not exist for first answer'
|
784
|
-
setvar = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="100"]').first
|
785
|
-
assert setvar, 'setvar does not exist for first answer'
|
786
|
-
|
787
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="JavaScript"]/../..').first
|
788
|
-
assert condition, 'condition does not exist for second answer'
|
789
|
-
setvar = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="50"]').first
|
790
|
-
assert setvar, 'setvar does not exist for second answer'
|
791
|
-
|
792
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="Java"]/../..').first
|
793
|
-
assert condition, 'condition does not exist for third answer'
|
794
|
-
setvar = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="10"]').first
|
795
|
-
assert setvar, 'setvar does not exist for third answer'
|
796
|
-
|
797
|
-
# Feedback
|
798
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="Ruby"]/../..').first
|
799
|
-
assert condition, 'feedback condition does not exist for first answer'
|
800
|
-
feedback = condition.xpath('displayfeedback[@feedbacktype="Response" and @linkrefid="40_fb"]').first
|
801
|
-
assert feedback, 'displayfeedback does not exist for first answer'
|
802
|
-
|
803
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="JavaScript"]/../..').first
|
804
|
-
assert condition, 'feedback condition does not exist for second answer'
|
805
|
-
feedback = condition.xpath('displayfeedback[@feedbacktype="Response" and @linkrefid="41_fb"]').first
|
806
|
-
assert feedback, 'displayfeedback does not exist for second answer'
|
807
|
-
|
808
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="Yes"]/conditionvar/varequal[@respident="response1" and text()="Java"]/../..').first
|
809
|
-
assert condition, 'feedback condition does not exist for third answer'
|
810
|
-
feedback = condition.xpath('displayfeedback[@feedbacktype="Response" and @linkrefid="42_fb"]').first
|
811
|
-
assert feedback, 'displayfeedback does not exist for third answer'
|
812
|
-
|
813
|
-
feedback = xml.root.xpath('itemfeedback[@ident="40_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
814
|
-
assert feedback, 'feedback text does not exist for first answer'
|
815
|
-
assert_equal 'Good choice!', feedback.text
|
816
|
-
feedback = xml.root.xpath('itemfeedback[@ident="41_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
817
|
-
assert feedback, 'feedback text does not exist for second answer'
|
818
|
-
assert_equal 'Not what I would have chosen...', feedback.text
|
819
|
-
feedback = xml.root.xpath('itemfeedback[@ident="42_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
820
|
-
assert feedback, 'feedback text does not exist for third answer'
|
821
|
-
assert_equal "You're kidding, right?", feedback.text
|
822
|
-
end
|
823
|
-
|
824
|
-
def test_it_creates_item_xml_for_true_false_question
|
825
|
-
true_false_question!
|
826
|
-
|
827
|
-
question = Moodle2CC::Canvas::Question.new @question
|
828
|
-
node = Builder::XmlMarkup.new
|
829
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
830
|
-
|
831
|
-
response = xml.root.xpath('presentation/response_lid').first
|
832
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
833
|
-
assert_equal 'response1', response.attributes['ident'].value
|
834
|
-
assert response.xpath('render_choice/response_label[@ident="44"]/material/mattext[@texttype="text/html" and text()="True"]').first, 'true response choice does not exist'
|
835
|
-
assert response.xpath('render_choice/response_label[@ident="45"]/material/mattext[@texttype="text/html" and text()="False"]').first, 'false response choice does not exist'
|
836
|
-
|
837
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="44"]/../..').first
|
838
|
-
assert condition, 'condition does not exist for first answer'
|
839
|
-
feedback = condition.xpath('displayfeedback[@feedbacktype="Response" and @linkrefid="44_fb"]').first
|
840
|
-
assert feedback, 'displayfeedback does not exist for first answer'
|
841
|
-
setvar = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="100"]').first
|
842
|
-
assert setvar, 'setvar does not exist for first answer'
|
843
|
-
|
844
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]/conditionvar/varequal[@respident="response1" and text()="45"]/../..').first
|
845
|
-
assert condition, 'condition does not exist for second answer'
|
846
|
-
feedback = condition.xpath('displayfeedback[@feedbacktype="Response" and @linkrefid="45_fb"]').first
|
847
|
-
assert feedback, 'displayfeedback does not exist for second answer'
|
848
|
-
setvar = condition.xpath('setvar[@varname="SCORE" and @action="Set" and text()="0"]').first
|
849
|
-
assert setvar, 'setvar does not exist for second answer'
|
850
|
-
|
851
|
-
feedback = xml.root.xpath('itemfeedback[@ident="44_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
852
|
-
assert feedback, 'feedback text does not exist for first answer'
|
853
|
-
assert_equal 'Smarty pants!', feedback.text
|
854
|
-
feedback = xml.root.xpath('itemfeedback[@ident="45_fb"]/flow_mat/material/mattext[@texttype="text/html"]').first
|
855
|
-
assert feedback, 'feedback text does not exist for second answer'
|
856
|
-
assert_equal 'What exactly are you doing?', feedback.text
|
857
|
-
end
|
858
|
-
|
859
|
-
def test_it_creates_item_xml_for_embedded_answers_question
|
860
|
-
@question.type = 'multianswer'
|
861
|
-
question = Moodle2CC::Canvas::Question.new @question
|
862
|
-
node = Builder::XmlMarkup.new
|
863
|
-
xml = Nokogiri::XML(question.create_item_xml(node))
|
864
|
-
|
865
|
-
response = xml.root.xpath('presentation/response_str').first
|
866
|
-
assert_equal 'Single', response.attributes['rcardinality'].value
|
867
|
-
assert_equal 'response1', response.attributes['ident'].value
|
868
|
-
assert_equal 'No', response.xpath('render_fib/response_label').first.attributes['rshuffle'].value
|
869
|
-
assert_equal 'answer1', response.xpath('render_fib/response_label').first.attributes['ident'].value
|
870
|
-
|
871
|
-
# No Continue Condition
|
872
|
-
condition = xml.root.xpath('resprocessing/respcondition[@continue="No"]').first
|
873
|
-
assert condition, 'no continue condition node does not exist'
|
874
|
-
assert condition.xpath('conditionvar/other').first, 'conditionvar does not exist for no continue condition node'
|
875
|
-
end
|
876
|
-
end
|