fix Turnitin showing on assignents in non-Turninit course
fixes CNVS-26295 test plan: - enable Turnitin on an account (gollum.instructure.com/OtherServiceTestAccounts#Turnitin) - toggle an assignment to have Turnitin enabled and choose a submission type. - the assignment show page should show Turnitin as active - make the assignment "no submission" - the assignment show page should not show Turnitin as active - re-select a submission type for the assignment so the Turnitin text appears again - disable Turnitin on the account - the assignment show page should not show Turnitin as active Change-Id: Iac174e52831ddc5e565acfd3d294189f6f4cefd1 Reviewed-on: https://gerrit.instructure.com/71626 Reviewed-by: John Corrigan <jcorrigan@instructure.com> Tested-by: Jenkins QA-Review: Michael Hargiss <mhargiss@instructure.com> Product-Review: Jason Sparks <jsparks@instructure.com>
This commit is contained in:
parent
2ba6be4c38
commit
ae5b65f915
|
@ -75,4 +75,9 @@ module AssignmentsHelper
|
|||
@user.try_rescue(:short_name)
|
||||
end
|
||||
end
|
||||
|
||||
def turnitin_active?
|
||||
@assignment.turnitin_enabled? && @context.turnitin_enabled? &&
|
||||
!@assignment.submission_types.include?("none")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<span class='value'><%= @assignment.points_possible || t(:no_points, 'None') %></span>
|
||||
</li>
|
||||
<% if @assignment.expects_submission? || @assignment.expects_external_submission? %>
|
||||
<% turnitin_text = @assignment.turnitin_enabled? ? ' ' + t(:turnitin_enabled_short, '(Turnitin enabled)') : '' %>
|
||||
<% turnitin_text = turnitin_active? ? ' ' + t(:turnitin_enabled_short, '(Turnitin enabled)') : '' %>
|
||||
<li>
|
||||
<span class='title'><%= t :submitting, 'Submitting' %></span>
|
||||
<span class='value'><%= @assignment.readable_submission_types + turnitin_text %></span>
|
||||
|
@ -149,7 +149,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<% end -%>
|
||||
<% if @assignment.turnitin_enabled %>
|
||||
<% if turnitin_active? %>
|
||||
<div class="control-group">
|
||||
<div class="control-label"><%= t :turnitin, 'Turnitin' %></div>
|
||||
<div class="controls">
|
||||
|
|
|
@ -41,4 +41,42 @@ describe AssignmentsHelper do
|
|||
expect(assignment_publishing_enabled?(@assignment, @teacher)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe "#turnitin active?" do
|
||||
before(:once) do
|
||||
course_with_teacher(active_all: true)
|
||||
student_in_course(active_all: true)
|
||||
assignment_model(course: @course)
|
||||
@assignment.turnitin_enabled = true
|
||||
@context = @assignment.context
|
||||
@assignment.update_attributes!({
|
||||
submission_types: ["online_url"]
|
||||
})
|
||||
@context.account.update_attributes!({
|
||||
turnitin_settings: {:originality_report_visibility => 'after_grading'},
|
||||
turnitin_account_id: 12345,
|
||||
turnitin_shared_secret: "the same combination on my luggage"
|
||||
})
|
||||
end
|
||||
|
||||
it "returns true if turnitin is active on the assignment and account" do
|
||||
expect(turnitin_active?).to be_truthy
|
||||
end
|
||||
|
||||
it "returns false if the assignment does not require submissions" do
|
||||
@assignment.update_attributes!({
|
||||
submission_types: ["none"]
|
||||
})
|
||||
expect(turnitin_active?).to be_falsey
|
||||
end
|
||||
|
||||
it "returns false if turnitin is disabled on the account level" do
|
||||
@context.account.update_attributes!({
|
||||
turnitin_settings: nil,
|
||||
turnitin_account_id: nil,
|
||||
turnitin_shared_secret: nil
|
||||
})
|
||||
expect(turnitin_active?).to be_falsey
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue