scorm_engine 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scorm_engine/api/endpoints/dispatches.rb +1 -0
- data/lib/scorm_engine/api/endpoints/registrations.rb +5 -5
- data/lib/scorm_engine/configuration.rb +3 -2
- data/lib/scorm_engine/faraday/connection.rb +1 -1
- data/lib/scorm_engine/models/course.rb +35 -6
- data/lib/scorm_engine/models/course_configuration.rb +3 -3
- data/lib/scorm_engine/models/course_import.rb +22 -6
- data/lib/scorm_engine/models/destination.rb +9 -4
- data/lib/scorm_engine/models/dispatch.rb +44 -5
- data/lib/scorm_engine/models/dispatch_zip.rb +20 -2
- data/lib/scorm_engine/models/learner.rb +14 -4
- data/lib/scorm_engine/models/registration.rb +67 -22
- data/lib/scorm_engine/models/registration_activity_detail.rb +21 -11
- data/lib/scorm_engine/models/registration_configuration.rb +3 -3
- data/lib/scorm_engine/models/registration_launch_history.rb +46 -13
- data/lib/scorm_engine/models/registration_runtime_interaction.rb +58 -11
- data/lib/scorm_engine/version.rb +1 -1
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_id.yml +3 -3
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/fails_given_an_invalid_type.yml +3 -3
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_AICC.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM12.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Dispatches/_get_dispatch_zip/works_when_type_is_SCORM2004-3RD.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_failure_when_registration_does_not_exist.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_delete_registration/is_successful_when_registration_exists.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_false_when_registration_does_not_exist.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_exists/is_true_when_registration_exists.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/includes_results_we_expect.yml +6 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/is_successful.yml +6 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_instances/returns_an_array_of_registrations.yml +6 -8
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/fails_when_id_is_invalid.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/is_successful.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_launch_link/results/returns_a_URL_string.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/does_not_return_activity_details_by_default.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/detail/returns_activity_details_if_requested.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/fails_when_registration_does_not_exist.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registration_progress/returns_a_registration_when_it_exists.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/excludes_results.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_course_id/includes_results.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/excludes_results.yml +3 -5
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/filtering_by_learner_id/includes_results.yml +5 -7
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/includes_results_we_expect.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/is_successful.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_get_registrations/returns_an_array_of_registrations.yml +6 -9
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_course_id_is_invalid.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/fails_if_registration_id_already_exists.yml +6 -6
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful.yml +9 -11
- data/spec/fixtures/vcr/ScormEngine_Api_Endpoints_Registrations/_post_registration/is_successful_even_when_given_a_UTF8/slashed_username.yml +9 -47
- data/spec/scorm_engine/api/endpoints/dispatches_spec.rb +1 -1
- data/spec/scorm_engine/api/endpoints/registrations_spec.rb +8 -1
- data/spec/scorm_engine/configuration_spec.rb +22 -0
- data/spec/scorm_engine/models/course_import_spec.rb +2 -2
- data/spec/scorm_engine/models/course_spec.rb +2 -2
- data/spec/scorm_engine/models/dispatch_zip_spec.rb +1 -1
- data/spec/scorm_engine/models/registration_runtime_interaction_spec.rb +7 -0
- data/spec/scorm_engine/models/registration_spec.rb +7 -0
- metadata +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
RSpec.describe ScormEngine::Models::CourseImport do
|
2
2
|
describe ".new_from_api" do
|
3
3
|
describe "when :importResult is present" do
|
4
|
-
let(:subject) { described_class.new_from_api("result" => "id123", "importResult" => { "status" => "
|
4
|
+
let(:subject) { described_class.new_from_api("result" => "id123", "importResult" => { "status" => "running", "parserWarnings" => "watch out" }) }
|
5
5
|
|
6
6
|
it "sets the id" do
|
7
7
|
expect(subject.id).to eq "id123"
|
@@ -78,7 +78,7 @@ RSpec.describe ScormEngine::Models::CourseImport do
|
|
78
78
|
expect(subject.complete?).to eq true
|
79
79
|
end
|
80
80
|
|
81
|
-
it "is false when status is not
|
81
|
+
it "is false when status is not COMPLETE" do
|
82
82
|
subject = described_class.new_from_api("status" => "OOPS")
|
83
83
|
expect(subject.complete?).to eq false
|
84
84
|
end
|
@@ -90,9 +90,9 @@ RSpec.describe ScormEngine::Models::Course do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
describe ":course_learning_standard" do
|
93
|
-
it "is set properly" do
|
93
|
+
it "is set properly as uppercase" do
|
94
94
|
course = described_class.new_from_api(
|
95
|
-
"courseLearningStandard" => "
|
95
|
+
"courseLearningStandard" => "scorm_2004_4th_edition"
|
96
96
|
)
|
97
97
|
expect(course.course_learning_standard).to eq "SCORM_2004_4TH_EDITION"
|
98
98
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
RSpec.describe ScormEngine::Models::RegistrationRuntimeInteraction do
|
2
2
|
describe ".new_from_api" do
|
3
3
|
let(:options) { {
|
4
|
+
"type" => "TrueFalse",
|
4
5
|
"id" => "interaction-123",
|
5
6
|
"description" => " foo \t bar \n baz ",
|
6
7
|
"timestampUtc" => "2018-05-24T00:01:02.00Z",
|
@@ -13,6 +14,12 @@ RSpec.describe ScormEngine::Models::RegistrationRuntimeInteraction do
|
|
13
14
|
|
14
15
|
let(:interaction) { described_class.new_from_api(options) }
|
15
16
|
|
17
|
+
describe ":type" do
|
18
|
+
it "is set properly" do
|
19
|
+
expect(interaction.type).to eq "TRUEFALSE"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
16
23
|
describe ":id" do
|
17
24
|
it "is set properly" do
|
18
25
|
expect(interaction.id).to eq "interaction-123"
|
@@ -15,6 +15,7 @@ RSpec.describe ScormEngine::Models::Registration do
|
|
15
15
|
"firstName" => "Bobby",
|
16
16
|
"lastName" => "Jones",
|
17
17
|
},
|
18
|
+
"totalSecondsTracked" => "456",
|
18
19
|
} }
|
19
20
|
|
20
21
|
let(:registration) { described_class.new_from_api(options) }
|
@@ -79,6 +80,12 @@ RSpec.describe ScormEngine::Models::Registration do
|
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
83
|
+
describe ":total_seconds_tracked" do
|
84
|
+
it "is set properly" do
|
85
|
+
expect(registration.total_seconds_tracked).to eq 456
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
82
89
|
describe "#complete?" do
|
83
90
|
it "is nil when completion is UNKNOWN" do
|
84
91
|
registration = described_class.new_from_api("registrationCompletion" => "UNKNOWN")
|