rspec 3-ify spec/migrations
refs CNVS-16239 Change-Id: I1abcd23d390b7a4a4b1215c4ac6cf46cd5886735 Reviewed-on: https://gerrit.instructure.com/42662 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Braden Anderson <braden@instructure.com> Product-Review: Braden Anderson <braden@instructure.com> QA-Review: Braden Anderson <braden@instructure.com>
This commit is contained in:
parent
ab12037de9
commit
e8ae046632
|
@ -22,7 +22,7 @@ require 'db/migrate/20140530195059_remove_course_id_from_content_exports.rb'
|
|||
describe 'AddContextToContentExports' do
|
||||
describe "up" do
|
||||
it "should populate all content exports with course context type and context id" do
|
||||
pending("PostgreSQL specific") unless ContentExport.connection.adapter_name == 'PostgreSQL'
|
||||
skip("PostgreSQL specific") unless ContentExport.connection.adapter_name == 'PostgreSQL'
|
||||
course1 = course
|
||||
course2 = course
|
||||
|
||||
|
@ -37,10 +37,10 @@ describe 'AddContextToContentExports' do
|
|||
|
||||
ce1 = course1.content_exports.first
|
||||
ce2 = course2.content_exports.first
|
||||
ce1.context_type.should == 'Course'
|
||||
expect(ce1.context_type).to eq 'Course'
|
||||
ce1.context_id = course1.id
|
||||
ce2.context_type.should == 'Course'
|
||||
ce2.context_id.should == course2.id
|
||||
expect(ce2.context_type).to eq 'Course'
|
||||
expect(ce2.context_id).to eq course2.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,17 +24,18 @@ describe "AddManageRubricsPermission" do
|
|||
|
||||
new_role_overrides = RoleOverride.find(:all, :conditions => {:permission => 'manage_rubrics'})
|
||||
|
||||
role_overrides.count.should == new_role_overrides.count
|
||||
expect(role_overrides.count).to eq new_role_overrides.count
|
||||
role_overrides.each do |old_role_override|
|
||||
new_role_override = new_role_overrides.find{|ro|
|
||||
ro.context_id == old_role_override.context_id &&
|
||||
ro.context_type == old_role_override.context_type &&
|
||||
ro.enrollment_type == old_role_override.enrollment_type
|
||||
}
|
||||
new_role_override.should_not be_nil
|
||||
expect(new_role_override).not_to be_nil
|
||||
|
||||
new_role_override.attributes.delete_if{|k,v| [:id, :permission, :created_at, :updated_at].include?(k.to_sym)}.should ==
|
||||
expect(new_role_override.attributes.delete_if{|k,v| [:id, :permission, :created_at, :updated_at].include?(k.to_sym)}).to eq(
|
||||
old_role_override.attributes.delete_if{|k,v| [:id, :permission, :created_at, :updated_at].include?(k.to_sym)}
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ describe "AddManageRubricsPermission" do
|
|||
AddManageStorageQuotasPermission.up
|
||||
|
||||
new_permissions = @account.role_overrides.where(:permission => 'manage_storage_quotas')
|
||||
new_permissions.where(:enrollment_type => 'CanManageAccountStuff').map(&:enabled).should == [true]
|
||||
new_permissions.where(:enrollment_type => 'TotallyCannot').map(&:enabled).should == [false]
|
||||
expect(new_permissions.where(:enrollment_type => 'CanManageAccountStuff').map(&:enabled)).to eq [true]
|
||||
expect(new_permissions.where(:enrollment_type => 'TotallyCannot').map(&:enabled)).to eq [false]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,18 +39,18 @@ describe "AddPseudonymToStudentViewStudents" do
|
|||
@fake2.pseudonym.destroy!
|
||||
@fake3.pseudonym.destroy!
|
||||
|
||||
@fake1.reload.pseudonym.should_not be_nil
|
||||
@fake2.reload.pseudonym.should be_nil
|
||||
@fake3.reload.pseudonym.should be_nil
|
||||
expect(@fake1.reload.pseudonym).not_to be_nil
|
||||
expect(@fake2.reload.pseudonym).to be_nil
|
||||
expect(@fake3.reload.pseudonym).to be_nil
|
||||
|
||||
DataFixup::AddPseudonymToStudentViewStudents.run
|
||||
|
||||
@fake1.reload.pseudonyms.count.should eql 1
|
||||
@fake2.reload.pseudonyms.count.should eql 1
|
||||
@fake3.reload.pseudonyms.count.should eql 1
|
||||
expect(@fake1.reload.pseudonyms.count).to eql 1
|
||||
expect(@fake2.reload.pseudonyms.count).to eql 1
|
||||
expect(@fake3.reload.pseudonyms.count).to eql 1
|
||||
|
||||
@fake1.reload.pseudonym.unique_id.should eql Canvas::Security.hmac_sha1("Test Student_#{@fake1.id}")
|
||||
@fake2.reload.pseudonym.unique_id.should eql Canvas::Security.hmac_sha1("Test Student_#{@fake2.id}")
|
||||
@fake3.reload.pseudonym.unique_id.should eql Canvas::Security.hmac_sha1("Test Student_#{@fake3.id}")
|
||||
expect(@fake1.reload.pseudonym.unique_id).to eql Canvas::Security.hmac_sha1("Test Student_#{@fake1.id}")
|
||||
expect(@fake2.reload.pseudonym.unique_id).to eql Canvas::Security.hmac_sha1("Test Student_#{@fake2.id}")
|
||||
expect(@fake3.reload.pseudonym.unique_id).to eql Canvas::Security.hmac_sha1("Test Student_#{@fake3.id}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ require 'db/migrate/20140806162559_drop_has_columns_from_context_external_tools.
|
|||
describe 'CreateContextExternalToolPlacements' do
|
||||
describe "up" do
|
||||
it "should populate the context external tool placements table" do
|
||||
pending("PostgreSQL specific") unless ContentExport.connection.adapter_name == 'PostgreSQL'
|
||||
skip("PostgreSQL specific") unless ContentExport.connection.adapter_name == 'PostgreSQL'
|
||||
course
|
||||
|
||||
migration1 = CreateContextExternalToolPlacements.new
|
||||
|
@ -14,7 +14,7 @@ describe 'CreateContextExternalToolPlacements' do
|
|||
tool1 = @course.context_external_tools.new(:name => 'blah', :domain => "google.com", :consumer_key => '12345', :shared_secret => 'secret')
|
||||
tool1.settings = {:course_navigation => {:url => "http://www.example.com"}}
|
||||
tool1.save!
|
||||
tool1.has_placement?(:course_navigation).should == true
|
||||
expect(tool1.has_placement?(:course_navigation)).to eq true
|
||||
|
||||
migration2.down
|
||||
migration1.down
|
||||
|
@ -22,7 +22,7 @@ describe 'CreateContextExternalToolPlacements' do
|
|||
# make sure that the down undoes all the things
|
||||
ContextExternalTool.reset_column_information
|
||||
tool1_old = ContextExternalTool.find(tool1.id)
|
||||
tool1_old.has_course_navigation.should == true
|
||||
expect(tool1_old.has_course_navigation).to eq true
|
||||
|
||||
migration1.up
|
||||
|
||||
|
@ -43,11 +43,11 @@ describe 'CreateContextExternalToolPlacements' do
|
|||
migration2.up
|
||||
ContextExternalTool.reset_column_information
|
||||
tool1.reload
|
||||
tool1.has_placement?(:course_navigation).should == false
|
||||
tool1.has_placement?(:account_navigation).should == true
|
||||
expect(tool1.has_placement?(:course_navigation)).to eq false
|
||||
expect(tool1.has_placement?(:account_navigation)).to eq true
|
||||
|
||||
tool2 = @course.context_external_tools.detect{|t| t.id != tool1.id}
|
||||
tool2.has_placement?(:user_navigation).should == true
|
||||
expect(tool2.has_placement?(:user_navigation)).to eq true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,16 +35,16 @@ describe 'DisableOpenRegistrationForDelegatedAuth' do
|
|||
# apply
|
||||
account.write_attribute(:settings, { :open_registration => true })
|
||||
account.save!
|
||||
account.open_registration?.should be_true
|
||||
expect(account.open_registration?).to be_truthy
|
||||
end
|
||||
|
||||
DisableOpenRegistrationForDelegatedAuth.up
|
||||
|
||||
@all_accounts.each(&:reload)
|
||||
@cas_account.open_registration?.should be_false
|
||||
@saml_account.open_registration?.should be_false
|
||||
@ldap_account.open_registration?.should be_true
|
||||
@normal_account.open_registration?.should be_true
|
||||
expect(@cas_account.open_registration?).to be_falsey
|
||||
expect(@saml_account.open_registration?).to be_falsey
|
||||
expect(@ldap_account.open_registration?).to be_truthy
|
||||
expect(@normal_account.open_registration?).to be_truthy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,9 +25,9 @@ describe 'DataFixup::FilterPageViewUrlParams' do
|
|||
Setting.set('filter_page_view_url_params_batch_size', '2')
|
||||
3.times { page_view_model() }
|
||||
@pv = page_view_model(url: 'http://canvas.example.com/api/v1/courses/1?access_token=xyz')
|
||||
@pv.reload.read_attribute(:url).should == 'http://canvas.example.com/api/v1/courses/1?access_token=xyz'
|
||||
expect(@pv.reload.read_attribute(:url)).to eq 'http://canvas.example.com/api/v1/courses/1?access_token=xyz'
|
||||
DataFixup::FilterPageViewUrlParams.run
|
||||
@pv.reload.read_attribute(:url).should == 'http://canvas.example.com/api/v1/courses/1?access_token=[FILTERED]'
|
||||
expect(@pv.reload.read_attribute(:url)).to eq 'http://canvas.example.com/api/v1/courses/1?access_token=[FILTERED]'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -7,21 +7,21 @@ describe 'DataFixup::FixBrokenFileLinksInAssignments' do
|
|||
assignment_model
|
||||
@assignment.description = '<a id="l16" href="/files/1/download">oi</a>'
|
||||
@assignment.save!
|
||||
DataFixup::FixBrokenFileLinksInAssignments.broken_assignment_scope.count.should == 1
|
||||
expect(DataFixup::FixBrokenFileLinksInAssignments.broken_assignment_scope.count).to eq 1
|
||||
end
|
||||
|
||||
it "should find assignments with verifiers" do
|
||||
assignment_model
|
||||
@assignment.description = '<a id="l16" href="/files/1/download?verifier=hahaha">oi</a>'
|
||||
@assignment.save!
|
||||
DataFixup::FixBrokenFileLinksInAssignments.broken_assignment_scope.count.should == 1
|
||||
expect(DataFixup::FixBrokenFileLinksInAssignments.broken_assignment_scope.count).to eq 1
|
||||
end
|
||||
|
||||
it "should not find assignments with only normal links" do
|
||||
assignment_model
|
||||
@assignment.description = '<a id="l16" href="/courses/1/files/1/download?wrap=1>oi</a>'
|
||||
@assignment.save!
|
||||
DataFixup::FixBrokenFileLinksInAssignments.broken_assignment_scope.count.should == 0
|
||||
expect(DataFixup::FixBrokenFileLinksInAssignments.broken_assignment_scope.count).to eq 0
|
||||
end
|
||||
|
||||
it "should fix links in assignment descriptions that point to deleted files with a verifier param" do
|
||||
|
@ -67,25 +67,25 @@ describe 'DataFixup::FixBrokenFileLinksInAssignments' do
|
|||
|
||||
@assignment.reload
|
||||
node = Nokogiri::HTML(@assignment.description)
|
||||
node.at_css('#l1 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
node.at_css('#l2 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
node.at_css('#l3 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
node.at_css('#l4 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l1 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l2 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l3 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l4 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
# other context cloned
|
||||
node.at_css('#l5 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
node.at_css('#l6 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
node.at_css('#l7 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
node.at_css('#l8 @href').text.should == "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l5 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l6 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l7 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
expect(node.at_css('#l8 @href').text).to eq "/courses/#{course2.id}/files/#{att2.id}/download?wrap=1"
|
||||
# other context not cloned
|
||||
node.at_css('#l9 @href').text.should == "/courses/#{course1.id}/files/#{att3.id}/download?verifier=hurpdurpdurp"
|
||||
node.at_css('#l10 @href').text.should == "/courses/#{course1.id}/files/#{att3.id}/download"
|
||||
node.at_css('#l11 @href').text.should == "/courses/#{course1.id}/files/#{att3.id}/download?verifier=hurpdurpdurp"
|
||||
node.at_css('#l12 @href').text.should == "/courses/#{course1.id}/files/#{att3.id}/download"
|
||||
expect(node.at_css('#l9 @href').text).to eq "/courses/#{course1.id}/files/#{att3.id}/download?verifier=hurpdurpdurp"
|
||||
expect(node.at_css('#l10 @href').text).to eq "/courses/#{course1.id}/files/#{att3.id}/download"
|
||||
expect(node.at_css('#l11 @href').text).to eq "/courses/#{course1.id}/files/#{att3.id}/download?verifier=hurpdurpdurp"
|
||||
expect(node.at_css('#l12 @href').text).to eq "/courses/#{course1.id}/files/#{att3.id}/download"
|
||||
|
||||
node.at_css('#l13 @href').text.should == "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
node.at_css('#l14 @href').text.should == "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
node.at_css('#l15 @href').text.should == "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
node.at_css('#l16 @href').text.should == "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
expect(node.at_css('#l13 @href').text).to eq "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
expect(node.at_css('#l14 @href').text).to eq "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
expect(node.at_css('#l15 @href').text).to eq "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
expect(node.at_css('#l16 @href').text).to eq "/courses/#{course2.id}/files/#{att6.id}/download?wrap=1"
|
||||
end
|
||||
|
||||
it "should find new courses's attachment by old attachment cloned_item_id" do
|
||||
|
@ -99,7 +99,7 @@ describe 'DataFixup::FixBrokenFileLinksInAssignments' do
|
|||
att1.reload
|
||||
|
||||
att2_2 = course2.attachments.find_by_cloned_item_id(att1.cloned_item_id) if att1.cloned_item_id
|
||||
att2_2.should == att2
|
||||
expect(att2_2).to eq att2
|
||||
end
|
||||
|
||||
it "shouldn't break a discussion assignment" do
|
||||
|
@ -109,14 +109,14 @@ describe 'DataFixup::FixBrokenFileLinksInAssignments' do
|
|||
topic = @assignment.discussion_topic
|
||||
|
||||
topic.reload
|
||||
topic.assignment.should_not be_nil
|
||||
expect(topic.assignment).not_to be_nil
|
||||
|
||||
FixBrokenFileLinksInAssignments.up
|
||||
|
||||
@assignment.reload
|
||||
@assignment.description.should == "<a id=\"l3\" href=\"/courses/#{course1.id}/files/#{att1.id}/download?wrap=1\">no context, verifier</a>"
|
||||
expect(@assignment.description).to eq "<a id=\"l3\" href=\"/courses/#{course1.id}/files/#{att1.id}/download?wrap=1\">no context, verifier</a>"
|
||||
|
||||
topic.reload
|
||||
topic.assignment.should_not be_nil
|
||||
expect(topic.assignment).not_to be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,9 +34,9 @@ describe 'DataFixup::FixBulkMessageAttachments' do
|
|||
DataFixup::FixBulkMessageAttachments.run
|
||||
|
||||
# yay
|
||||
AttachmentAssociation.count.should eql 21
|
||||
expect(AttachmentAssociation.count).to eql 21
|
||||
ConversationMessage.all.each do |message|
|
||||
message.attachments.should == root_message.attachments
|
||||
expect(message.attachments).to eq root_message.attachments
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,7 +10,7 @@ describe 'FixContentTagsWithoutContents' do
|
|||
tag.save(:validate => false)
|
||||
FixContentTagsWithoutContent.new.up
|
||||
|
||||
ContentTag.find_by_id(tag.id).should be_nil
|
||||
expect(ContentTag.find_by_id(tag.id)).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,7 +9,7 @@ describe DataFixup::AttachDissociatedDiscussionTopics do
|
|||
topic.update_attribute(:old_assignment_id, assignment.id)
|
||||
|
||||
DataFixup::AttachDissociatedDiscussionTopics.run
|
||||
topic.reload.assignment_id.should == assignment.id
|
||||
expect(topic.reload.assignment_id).to eq assignment.id
|
||||
end
|
||||
|
||||
it 'should not change topics with an existing assignment_id' do
|
||||
|
@ -19,7 +19,7 @@ describe DataFixup::AttachDissociatedDiscussionTopics do
|
|||
topic.update_attribute(:old_assignment_id, assignment.id - 1)
|
||||
|
||||
DataFixup::AttachDissociatedDiscussionTopics.run
|
||||
topic.reload.assignment_id.should == assignment.id
|
||||
expect(topic.reload.assignment_id).to eq assignment.id
|
||||
end
|
||||
|
||||
it 'should not change topics that have no file link in their message' do
|
||||
|
@ -29,6 +29,6 @@ describe DataFixup::AttachDissociatedDiscussionTopics do
|
|||
topic.update_attribute(:old_assignment_id, assignment.id)
|
||||
|
||||
DataFixup::AttachDissociatedDiscussionTopics.run
|
||||
topic.reload.assignment_id.should be_nil
|
||||
expect(topic.reload.assignment_id).to be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -18,15 +18,15 @@ describe 'DataFixup::FixImportedWikiPageWorkflow' do
|
|||
end
|
||||
|
||||
it "should find unpublished wiki pages" do
|
||||
DataFixup::FixImportedWikiPageWorkflow.broken_wiki_page_scope.map(&:id).sort.should == @wiki_pages.map(&:id).sort
|
||||
expect(DataFixup::FixImportedWikiPageWorkflow.broken_wiki_page_scope.map(&:id).sort).to eq @wiki_pages.map(&:id).sort
|
||||
end
|
||||
|
||||
it "should publish the broken wiki pages" do
|
||||
FixImportedWikiPageWorkflow.up
|
||||
@wiki_pages.each do |page|
|
||||
page.reload
|
||||
page.workflow_state.should == 'active'
|
||||
expect(page.workflow_state).to eq 'active'
|
||||
end
|
||||
DataFixup::FixImportedWikiPageWorkflow.broken_wiki_page_scope.count.should == 0
|
||||
expect(DataFixup::FixImportedWikiPageWorkflow.broken_wiki_page_scope.count).to eq 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ describe 'DataFixup::FixIncorrectAttachmentFileState' do
|
|||
file1 = attachment_model file_state: 'active'
|
||||
file2 = attachment_model file_state: 'deleted'
|
||||
FixIncorrectAttachmentFileState.up
|
||||
file1.reload.file_state.should == 'available'
|
||||
file2.reload.file_state.should == 'deleted'
|
||||
expect(file1.reload.file_state).to eq 'available'
|
||||
expect(file2.reload.file_state).to eq 'deleted'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,36 +23,36 @@ describe 'FixIncorrectPublishedStatesOnQuizzesAndAssignments' do
|
|||
it "should update the right assignments" do
|
||||
course(:active_all => true)
|
||||
a1 = @course.assignments.create!(:name => 'hi')
|
||||
a1.workflow_state.should == "published"
|
||||
expect(a1.workflow_state).to eq "published"
|
||||
|
||||
a2 = @course.assignments.create!(:name => 'hi')
|
||||
Assignment.where(:id => a2.id).update_all(:workflow_state => "available")
|
||||
a2.reload.workflow_state.should == "available"
|
||||
expect(a2.reload.workflow_state).to eq "available"
|
||||
|
||||
a3 = @course.assignments.create!(:name => 'hi')
|
||||
Assignment.where(:id => a3.id).update_all(:workflow_state => "active")
|
||||
a3.reload.workflow_state.should == "active"
|
||||
expect(a3.reload.workflow_state).to eq "active"
|
||||
|
||||
a4 = @course.assignments.create!(:name => 'hi')
|
||||
a4.destroy
|
||||
a4.workflow_state.should == "deleted"
|
||||
expect(a4.workflow_state).to eq "deleted"
|
||||
|
||||
FixIncorrectPublishedStatesForQuizzesAndAssignments.up
|
||||
|
||||
a1.reload.workflow_state.should == "published"
|
||||
a2.reload.workflow_state.should == "published"
|
||||
a3.reload.workflow_state.should == "published"
|
||||
a4.reload.workflow_state.should == "deleted"
|
||||
expect(a1.reload.workflow_state).to eq "published"
|
||||
expect(a2.reload.workflow_state).to eq "published"
|
||||
expect(a3.reload.workflow_state).to eq "published"
|
||||
expect(a4.reload.workflow_state).to eq "deleted"
|
||||
end
|
||||
|
||||
it "should update the right quizzes" do
|
||||
course(active_all: true)
|
||||
q1 = @course.quizzes.create! title: 'this'
|
||||
q1.workflow_state.should == 'created'
|
||||
expect(q1.workflow_state).to eq 'created'
|
||||
|
||||
q2 = @course.quizzes.create! title: 'that'
|
||||
q2.publish!
|
||||
q2.workflow_state.should == 'available'
|
||||
expect(q2.workflow_state).to eq 'available'
|
||||
|
||||
q3 = @course.quizzes.create! title: 'the_other'
|
||||
q3.publish!
|
||||
|
@ -60,13 +60,13 @@ describe 'FixIncorrectPublishedStatesOnQuizzesAndAssignments' do
|
|||
|
||||
q4 = @course.quizzes.create!
|
||||
q4.destroy
|
||||
q4.workflow_state.should == 'deleted'
|
||||
expect(q4.workflow_state).to eq 'deleted'
|
||||
|
||||
FixIncorrectPublishedStatesForQuizzesAndAssignments.up
|
||||
|
||||
q1.reload.workflow_state.should == 'created'
|
||||
q2.reload.workflow_state.should == 'available'
|
||||
q3.reload.workflow_state.should == 'available'
|
||||
q4.reload.workflow_state.should == 'deleted'
|
||||
expect(q1.reload.workflow_state).to eq 'created'
|
||||
expect(q2.reload.workflow_state).to eq 'available'
|
||||
expect(q3.reload.workflow_state).to eq 'available'
|
||||
expect(q4.reload.workflow_state).to eq 'deleted'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,8 +39,8 @@ describe DataFixup::FixMediaRecordingSubmissionTypes do
|
|||
DataFixup::FixMediaRecordingSubmissionTypes.run
|
||||
|
||||
# verify the results
|
||||
assign1.reload.submission_types.should == 'online_recording,media_recording,online_text_entry'
|
||||
assign2.reload.submission_types.should == 'online_recording,media_recording,online_text_entry'
|
||||
assign3.reload.submission_types.should == 'discussion_topic'
|
||||
expect(assign1.reload.submission_types).to eq 'online_recording,media_recording,online_text_entry'
|
||||
expect(assign2.reload.submission_types).to eq 'online_recording,media_recording,online_text_entry'
|
||||
expect(assign3.reload.submission_types).to eq 'discussion_topic'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,22 +34,22 @@ describe DataFixup::FixOutOfSyncOutcomeAlignments do
|
|||
align1 = @rubric_association_object.learning_outcome_alignments.first
|
||||
align2 = @rubric.learning_outcome_alignments.first
|
||||
|
||||
align1.reload.should_not be_deleted
|
||||
align2.reload.should_not be_deleted
|
||||
expect(align1.reload).not_to be_deleted
|
||||
expect(align2.reload).not_to be_deleted
|
||||
|
||||
DataFixup::FixOutOfSyncOutcomeAlignments.run
|
||||
|
||||
align1.reload.should_not be_deleted
|
||||
align2.reload.should_not be_deleted
|
||||
expect(align1.reload).not_to be_deleted
|
||||
expect(align2.reload).not_to be_deleted
|
||||
end
|
||||
|
||||
it "should delete alignments to deleted rubrics" do
|
||||
align = @rubric.learning_outcome_alignments.first
|
||||
Rubric.where(:id => @rubric.id).update_all(:workflow_state => 'deleted')
|
||||
|
||||
align.reload.should_not be_deleted
|
||||
expect(align.reload).not_to be_deleted
|
||||
DataFixup::FixOutOfSyncOutcomeAlignments.run
|
||||
align.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
end
|
||||
|
||||
it "should delete alignments to rubrics that no longer should be aligned" do
|
||||
|
@ -58,18 +58,18 @@ describe DataFixup::FixOutOfSyncOutcomeAlignments do
|
|||
data.first.delete(:learning_outcome_id)
|
||||
Rubric.where(:id => @rubric.id).update_all(:data => data.to_yaml)
|
||||
|
||||
align.reload.should_not be_deleted
|
||||
expect(align.reload).not_to be_deleted
|
||||
DataFixup::FixOutOfSyncOutcomeAlignments.run
|
||||
align.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
end
|
||||
|
||||
it "should delete alignments to assignments without rubrics" do
|
||||
align = @rubric_association_object.learning_outcome_alignments.first
|
||||
RubricAssociation.where(:rubric_id => @rubric.id).delete_all
|
||||
|
||||
align.reload.should_not be_deleted
|
||||
expect(align.reload).not_to be_deleted
|
||||
DataFixup::FixOutOfSyncOutcomeAlignments.run
|
||||
align.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
end
|
||||
|
||||
it "should delete alignments to assignments with rubrics without matching alignments" do
|
||||
|
@ -77,8 +77,8 @@ describe DataFixup::FixOutOfSyncOutcomeAlignments do
|
|||
lo = LearningOutcome.create!(short_description: 's')
|
||||
@rubric.learning_outcome_alignments.update_all(:learning_outcome_id => lo)
|
||||
|
||||
align.reload.should_not be_deleted
|
||||
expect(align.reload).not_to be_deleted
|
||||
DataFixup::FixOutOfSyncOutcomeAlignments.run
|
||||
align.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ describe DataFixup::FixRootOutcomeGroupTitles do
|
|||
@course.account.reload
|
||||
|
||||
# verify the results
|
||||
@course.learning_outcome_groups.first.title.should == @course.name
|
||||
@course.account.learning_outcome_groups.first.title.should == 'ROOT'
|
||||
expect(@course.learning_outcome_groups.first.title).to eq @course.name
|
||||
expect(@course.account.learning_outcome_groups.first.title).to eq 'ROOT'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -56,9 +56,9 @@ describe 'FixUserConversationsCountsForAll' do
|
|||
|
||||
FixUserConversationsCountsForAll.up
|
||||
|
||||
u1.reload.unread_conversations_count.should == 2
|
||||
u2.reload.unread_conversations_count.should == 1
|
||||
u3.reload.unread_conversations_count.should == 3
|
||||
expect(u1.reload.unread_conversations_count).to eq 2
|
||||
expect(u2.reload.unread_conversations_count).to eq 1
|
||||
expect(u3.reload.unread_conversations_count).to eq 3
|
||||
end
|
||||
|
||||
it "should not count deleted entries" do
|
||||
|
@ -92,8 +92,8 @@ describe 'FixUserConversationsCountsForAll' do
|
|||
|
||||
FixUserConversationsCountsForAll.up
|
||||
|
||||
u1.reload.unread_conversations_count.should == 2
|
||||
u2.reload.unread_conversations_count.should == 0
|
||||
expect(u1.reload.unread_conversations_count).to eq 2
|
||||
expect(u2.reload.unread_conversations_count).to eq 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ require 'db/migrate/20120404230916_fix_user_merge_conversations2.rb'
|
|||
describe 'FixUserMergeConversations2' do
|
||||
describe "up" do
|
||||
it "should work" do
|
||||
pending("can't create the bad state anymore due to foreign keys preventing it")
|
||||
skip("can't create the bad state anymore due to foreign keys preventing it")
|
||||
u1 = user
|
||||
u2 = user
|
||||
u3 = user
|
||||
|
@ -52,26 +52,26 @@ describe 'FixUserMergeConversations2' do
|
|||
unrelated.reload
|
||||
|
||||
# these are gone for reals now
|
||||
lambda { borked.reload }.should raise_error
|
||||
borked_cps.each { |cp| lambda { cp.reload }.should raise_error }
|
||||
expect { borked.reload }.to raise_error
|
||||
borked_cps.each { |cp| expect { cp.reload }.to raise_error }
|
||||
|
||||
# these are moved to the right place
|
||||
borked_cmps.each do |cmp|
|
||||
lambda { cmp.reload }.should_not raise_error
|
||||
cmp.conversation_participant.conversation.should eql correct
|
||||
expect { cmp.reload }.not_to raise_error
|
||||
expect(cmp.conversation_participant.conversation).to eql correct
|
||||
end
|
||||
correct.conversation_participants.each do |cp|
|
||||
cp.messages.size.should eql 2
|
||||
cp.message_count.should eql 2
|
||||
expect(cp.messages.size).to eql 2
|
||||
expect(cp.message_count).to eql 2
|
||||
end
|
||||
# got bumped out of archived by the merged/deleted ones
|
||||
correct.conversation_participants.default.size.should eql 2
|
||||
correct.conversation_participants.unread.size.should eql 1
|
||||
expect(correct.conversation_participants.default.size).to eql 2
|
||||
expect(correct.conversation_participants.unread.size).to eql 1
|
||||
|
||||
# no changes here
|
||||
unrelated.conversation_participants.each do |cp|
|
||||
cp.messages.size.should eql 1
|
||||
cp.message_count.should eql 1
|
||||
expect(cp.messages.size).to eql 1
|
||||
expect(cp.message_count).to eql 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ require 'db/migrate/20120216163427_fix_user_merge_conversations.rb'
|
|||
describe 'FixUserMergeConversations' do
|
||||
describe "up" do
|
||||
it "should work" do
|
||||
pending "no longer possible to create bad data due to db constraint"
|
||||
skip "no longer possible to create bad data due to db constraint"
|
||||
u1 = user
|
||||
u2 = user
|
||||
u3 = user
|
||||
|
@ -30,7 +30,7 @@ describe 'FixUserMergeConversations' do
|
|||
c1 = Conversation.initiate([u1, u2], true)
|
||||
c1.conversation_participants.create!(:user => u1)
|
||||
c1.update_attribute(:private_hash, 'no longer valid')
|
||||
c1.conversation_participants.size.should eql 3
|
||||
expect(c1.conversation_participants.size).to eql 3
|
||||
|
||||
c2 = Conversation.initiate([u1, u3], true)
|
||||
c2.update_attribute(:private_hash, 'well this is clearly wrong')
|
||||
|
@ -39,9 +39,9 @@ describe 'FixUserMergeConversations' do
|
|||
|
||||
FixUserMergeConversations.up
|
||||
|
||||
c1.reload.conversation_participants.size.should eql 2
|
||||
c1.private_hash.should_not eql 'no longer valid'
|
||||
lambda { c2.reload }.should raise_error
|
||||
expect(c1.reload.conversation_participants.size).to eql 2
|
||||
expect(c1.private_hash).not_to eql 'no longer valid'
|
||||
expect { c2.reload }.to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,18 +33,18 @@ describe 'MoveAccountMembershipTypes' do
|
|||
it "should add active roles for each membership type" do
|
||||
MoveAccountMembershipTypes.up
|
||||
|
||||
@account1.roles.count.should == 2
|
||||
expect(@account1.roles.count).to eq 2
|
||||
role_names = ['role1', 'role2']
|
||||
@account1.roles.collect(&:name).sort.should == role_names
|
||||
expect(@account1.roles.collect(&:name).sort).to eq role_names
|
||||
role_names.each do |r|
|
||||
@account1.roles.find_by_name(r).workflow_state.should == 'active'
|
||||
expect(@account1.roles.find_by_name(r).workflow_state).to eq 'active'
|
||||
end
|
||||
|
||||
@account2.roles.count.should == 2
|
||||
expect(@account2.roles.count).to eq 2
|
||||
role_names = ['role2', 'role3']
|
||||
@account2.roles.collect(&:name).sort.should == role_names
|
||||
expect(@account2.roles.collect(&:name).sort).to eq role_names
|
||||
role_names.each do |r|
|
||||
@account2.roles.find_by_name(r).workflow_state.should == 'active'
|
||||
expect(@account2.roles.find_by_name(r).workflow_state).to eq 'active'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -63,13 +63,13 @@ describe 'MoveAccountMembershipTypes' do
|
|||
|
||||
MoveAccountMembershipTypes.up
|
||||
|
||||
@account1.roles.count.should == 2
|
||||
@account1.roles.find_by_name('role1').base_role_type.should == 'TeacherEnrollment'
|
||||
@account1.roles.find_by_name('role2').base_role_type.should == 'AccountMembership'
|
||||
expect(@account1.roles.count).to eq 2
|
||||
expect(@account1.roles.find_by_name('role1').base_role_type).to eq 'TeacherEnrollment'
|
||||
expect(@account1.roles.find_by_name('role2').base_role_type).to eq 'AccountMembership'
|
||||
|
||||
@account2.roles.count.should == 2
|
||||
@account2.roles.find_by_name('role2').base_role_type.should == 'StudentEnrollment'
|
||||
@account2.roles.find_by_name('role3').base_role_type.should == 'ObserverEnrollment'
|
||||
expect(@account2.roles.count).to eq 2
|
||||
expect(@account2.roles.find_by_name('role2').base_role_type).to eq 'StudentEnrollment'
|
||||
expect(@account2.roles.find_by_name('role3').base_role_type).to eq 'ObserverEnrollment'
|
||||
end
|
||||
|
||||
context "when adding inactive roles for role overrides" do
|
||||
|
@ -90,25 +90,25 @@ describe 'MoveAccountMembershipTypes' do
|
|||
end
|
||||
|
||||
it "should add inactive roles if there is a role-override referencing a missing type" do
|
||||
@account1.roles.count.should == 4
|
||||
@account1.roles.collect(&:name).sort.should == ['customrole1', 'customrole2', 'role1', 'role2']
|
||||
@account1.roles.find_by_name('customrole1').base_role_type.should == 'AccountMembership'
|
||||
@account1.roles.find_by_name('customrole1').workflow_state.should == 'inactive'
|
||||
@account1.roles.find_by_name('customrole2').base_role_type.should == 'AccountMembership'
|
||||
@account1.roles.find_by_name('customrole2').workflow_state.should == 'inactive'
|
||||
expect(@account1.roles.count).to eq 4
|
||||
expect(@account1.roles.collect(&:name).sort).to eq ['customrole1', 'customrole2', 'role1', 'role2']
|
||||
expect(@account1.roles.find_by_name('customrole1').base_role_type).to eq 'AccountMembership'
|
||||
expect(@account1.roles.find_by_name('customrole1').workflow_state).to eq 'inactive'
|
||||
expect(@account1.roles.find_by_name('customrole2').base_role_type).to eq 'AccountMembership'
|
||||
expect(@account1.roles.find_by_name('customrole2').workflow_state).to eq 'inactive'
|
||||
|
||||
@account2.roles.count.should == 3
|
||||
@account2.roles.collect(&:name).sort.should == ['customrole2', 'role2', 'role3']
|
||||
@account2.roles.find_by_name('customrole2').base_role_type.should == 'AccountMembership'
|
||||
@account2.roles.find_by_name('customrole2').workflow_state.should == 'inactive'
|
||||
expect(@account2.roles.count).to eq 3
|
||||
expect(@account2.roles.collect(&:name).sort).to eq ['customrole2', 'role2', 'role3']
|
||||
expect(@account2.roles.find_by_name('customrole2').base_role_type).to eq 'AccountMembership'
|
||||
expect(@account2.roles.find_by_name('customrole2').workflow_state).to eq 'inactive'
|
||||
end
|
||||
|
||||
it "should not overwrite the active roles added" do
|
||||
@account2.roles.find_by_name('role2').workflow_state.should == 'active'
|
||||
expect(@account2.roles.find_by_name('role2').workflow_state).to eq 'active'
|
||||
end
|
||||
|
||||
it "should not overwrite an already existing role" do
|
||||
@account2.roles.find_by_name('role3').base_role_type.should == 'ObserverEnrollment'
|
||||
expect(@account2.roles.find_by_name('role3').base_role_type).to eq 'ObserverEnrollment'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,16 +120,16 @@ describe 'MoveAccountMembershipTypes' do
|
|||
|
||||
MoveAccountMembershipTypes.up
|
||||
|
||||
@account1.roles.count.should == 3
|
||||
@account1.roles.collect(&:name).sort.should == ['NonexistentType', 'role1', 'role2']
|
||||
@account1.roles.find_by_name('NonexistentType').base_role_type.should == 'AccountMembership'
|
||||
@account1.roles.find_by_name('NonexistentType').workflow_state.should == 'inactive'
|
||||
expect(@account1.roles.count).to eq 3
|
||||
expect(@account1.roles.collect(&:name).sort).to eq ['NonexistentType', 'role1', 'role2']
|
||||
expect(@account1.roles.find_by_name('NonexistentType').base_role_type).to eq 'AccountMembership'
|
||||
expect(@account1.roles.find_by_name('NonexistentType').workflow_state).to eq 'inactive'
|
||||
|
||||
@account2.roles.count.should == 4
|
||||
@account2.roles.collect(&:name).sort.should == ['AnotherNonexistentType', 'YetAnotherNonexistentType', 'role2', 'role3', ]
|
||||
expect(@account2.roles.count).to eq 4
|
||||
expect(@account2.roles.collect(&:name).sort).to eq ['AnotherNonexistentType', 'YetAnotherNonexistentType', 'role2', 'role3', ]
|
||||
['AnotherNonexistentType', 'YetAnotherNonexistentType'].each do |t|
|
||||
@account2.roles.find_by_name(t).base_role_type.should == 'AccountMembership'
|
||||
@account2.roles.find_by_name(t).workflow_state.should == 'inactive'
|
||||
expect(@account2.roles.find_by_name(t).base_role_type).to eq 'AccountMembership'
|
||||
expect(@account2.roles.find_by_name(t).workflow_state).to eq 'inactive'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -142,10 +142,10 @@ describe 'MoveAccountMembershipTypes' do
|
|||
|
||||
MoveAccountMembershipTypes.up
|
||||
|
||||
@account1.roles.count.should == 3
|
||||
@account1.roles.collect(&:name).sort.should == ['NonexistentType', 'role1', 'role2']
|
||||
@account1.roles.find_by_name('NonexistentType').base_role_type.should == 'TeacherEnrollment'
|
||||
@account1.roles.find_by_name('NonexistentType').workflow_state.should == 'active'
|
||||
expect(@account1.roles.count).to eq 3
|
||||
expect(@account1.roles.collect(&:name).sort).to eq ['NonexistentType', 'role1', 'role2']
|
||||
expect(@account1.roles.find_by_name('NonexistentType').base_role_type).to eq 'TeacherEnrollment'
|
||||
expect(@account1.roles.find_by_name('NonexistentType').workflow_state).to eq 'active'
|
||||
end
|
||||
|
||||
it "should not fail when encountering a user with a reserved membership type" do
|
||||
|
|
|
@ -37,8 +37,8 @@ describe 'DataFixup::MoveContentExportNotificationsToMigrationCategory' do
|
|||
|
||||
users.each do |u|
|
||||
nps = NotificationPolicy.for(u)
|
||||
nps.count.should == 1
|
||||
nps.first.notification.should == @n2
|
||||
expect(nps.count).to eq 1
|
||||
expect(nps.first.notification).to eq @n2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,8 +37,8 @@ describe 'DataFixup::MoveScribdDocsTo' do
|
|||
|
||||
users.each do |u|
|
||||
nps = NotificationPolicy.for(u)
|
||||
nps.count.should == 1
|
||||
nps.first.notification.should == @n2
|
||||
expect(nps.count).to eq 1
|
||||
expect(nps.first.notification).to eq @n2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -60,48 +60,48 @@ describe 'DataFixup::PopulateConversationMessageProperties' do
|
|||
[c1, c2, c3, c4, c5, c6, c7].each(&:reload)
|
||||
[m1, m2, m3, m4, m5, m6, m7].each(&:reload)
|
||||
|
||||
c1.has_attachments?.should be_false
|
||||
c1.has_media_objects?.should be_false
|
||||
m1.read_attribute(:has_attachments).should be_false
|
||||
m1.read_attribute(:has_media_objects).should be_false
|
||||
m1.attachment_ids.should be_nil
|
||||
m1.media_comment.should be_nil
|
||||
expect(c1.has_attachments?).to be_falsey
|
||||
expect(c1.has_media_objects?).to be_falsey
|
||||
expect(m1.read_attribute(:has_attachments)).to be_falsey
|
||||
expect(m1.read_attribute(:has_media_objects)).to be_falsey
|
||||
expect(m1.attachment_ids).to be_nil
|
||||
expect(m1.media_comment).to be_nil
|
||||
|
||||
c2.has_attachments?.should be_true
|
||||
c2.has_media_objects?.should be_false
|
||||
m2.read_attribute(:has_attachments).should be_true
|
||||
m2.read_attribute(:has_media_objects).should be_false
|
||||
m2.attachment_ids.should eql a.id.to_s
|
||||
expect(c2.has_attachments?).to be_truthy
|
||||
expect(c2.has_media_objects?).to be_falsey
|
||||
expect(m2.read_attribute(:has_attachments)).to be_truthy
|
||||
expect(m2.read_attribute(:has_media_objects)).to be_falsey
|
||||
expect(m2.attachment_ids).to eql a.id.to_s
|
||||
|
||||
c3.has_attachments?.should be_true
|
||||
c3.has_media_objects?.should be_false
|
||||
m3.read_attribute(:has_attachments).should be_true
|
||||
m3.read_attribute(:has_media_objects).should be_false
|
||||
m3.attachment_ids.should be_nil # it's on the forwarded message
|
||||
expect(c3.has_attachments?).to be_truthy
|
||||
expect(c3.has_media_objects?).to be_falsey
|
||||
expect(m3.read_attribute(:has_attachments)).to be_truthy
|
||||
expect(m3.read_attribute(:has_media_objects)).to be_falsey
|
||||
expect(m3.attachment_ids).to be_nil # it's on the forwarded message
|
||||
|
||||
c4.has_attachments?.should be_true
|
||||
c4.has_media_objects?.should be_false
|
||||
m4.read_attribute(:has_attachments).should be_true
|
||||
m4.read_attribute(:has_media_objects).should be_false
|
||||
m4.attachment_ids.should be_nil
|
||||
expect(c4.has_attachments?).to be_truthy
|
||||
expect(c4.has_media_objects?).to be_falsey
|
||||
expect(m4.read_attribute(:has_attachments)).to be_truthy
|
||||
expect(m4.read_attribute(:has_media_objects)).to be_falsey
|
||||
expect(m4.attachment_ids).to be_nil
|
||||
|
||||
c5.has_attachments?.should be_false
|
||||
c5.has_media_objects?.should be_true
|
||||
m5.read_attribute(:has_attachments).should be_false
|
||||
m5.read_attribute(:has_media_objects).should be_true
|
||||
m5.media_comment.should eql mc
|
||||
expect(c5.has_attachments?).to be_falsey
|
||||
expect(c5.has_media_objects?).to be_truthy
|
||||
expect(m5.read_attribute(:has_attachments)).to be_falsey
|
||||
expect(m5.read_attribute(:has_media_objects)).to be_truthy
|
||||
expect(m5.media_comment).to eql mc
|
||||
|
||||
c6.has_attachments?.should be_false
|
||||
c6.has_media_objects?.should be_true
|
||||
m6.read_attribute(:has_attachments).should be_false
|
||||
m6.read_attribute(:has_media_objects).should be_true
|
||||
m6.media_comment.should be_nil
|
||||
expect(c6.has_attachments?).to be_falsey
|
||||
expect(c6.has_media_objects?).to be_truthy
|
||||
expect(m6.read_attribute(:has_attachments)).to be_falsey
|
||||
expect(m6.read_attribute(:has_media_objects)).to be_truthy
|
||||
expect(m6.media_comment).to be_nil
|
||||
|
||||
c7.has_attachments?.should be_false
|
||||
c7.has_media_objects?.should be_true
|
||||
m7.read_attribute(:has_attachments).should be_false
|
||||
m7.read_attribute(:has_media_objects).should be_true
|
||||
m7.media_comment.should be_nil
|
||||
expect(c7.has_attachments?).to be_falsey
|
||||
expect(c7.has_media_objects?).to be_truthy
|
||||
expect(m7.read_attribute(:has_attachments)).to be_falsey
|
||||
expect(m7.read_attribute(:has_media_objects)).to be_truthy
|
||||
expect(m7.media_comment).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ require 'db/migrate/20120402054921_populate_conversation_root_account_ids.rb'
|
|||
describe 'PopulateConversationRootAccountIds' do
|
||||
describe "up" do
|
||||
it "should work" do
|
||||
pending "no longer possible since context_messages no longer exists"
|
||||
skip "no longer possible since context_messages no longer exists"
|
||||
u = user
|
||||
|
||||
# messages w/ account contexts
|
||||
|
@ -33,7 +33,7 @@ describe 'PopulateConversationRootAccountIds' do
|
|||
cn1.add_message(u, "test1").update_attribute(:context, a1a)
|
||||
cn1.add_message(u, "test2").update_attribute(:context, a1a)
|
||||
cn1.add_message(u, "test3").update_attribute(:context, a1b)
|
||||
cn1.root_account_ids.should eql []
|
||||
expect(cn1.root_account_ids).to eql []
|
||||
|
||||
# context message on course
|
||||
u2 = user
|
||||
|
@ -43,7 +43,7 @@ describe 'PopulateConversationRootAccountIds' do
|
|||
cn2.add_message(u, "test")
|
||||
Conversation.connection.execute "INSERT INTO context_messages(context_id, context_type) VALUES(#{c2.id}, 'Course')"
|
||||
cn2.conversation_messages.update_all("context_message_id = (SELECT id FROM context_messages ORDER BY id DESC LIMIT 1)")
|
||||
cn2.root_account_ids.should eql []
|
||||
expect(cn2.root_account_ids).to eql []
|
||||
|
||||
# context message on group
|
||||
u3 = user
|
||||
|
@ -54,7 +54,7 @@ describe 'PopulateConversationRootAccountIds' do
|
|||
cn3.add_message(u, "test")
|
||||
Conversation.connection.execute "INSERT INTO context_messages(context_id, context_type) VALUES(#{g3.id}, 'Group')"
|
||||
cn3.conversation_messages.update_all("context_message_id = (SELECT id FROM context_messages ORDER BY id DESC LIMIT 1)")
|
||||
cn3.root_account_ids.should eql []
|
||||
expect(cn3.root_account_ids).to eql []
|
||||
|
||||
# submission
|
||||
u4 = user
|
||||
|
@ -65,7 +65,7 @@ describe 'PopulateConversationRootAccountIds' do
|
|||
s4 = as4.submit_homework(u4, :submission_type => "online_text_entry", :body => "")
|
||||
cn4 = Conversation.initiate([u, u4], true)
|
||||
cn4.add_message(u, '').update_attribute(:asset, s4)
|
||||
cn4.root_account_ids.should eql []
|
||||
expect(cn4.root_account_ids).to eql []
|
||||
|
||||
# no root account info available
|
||||
u5 = user
|
||||
|
@ -74,11 +74,11 @@ describe 'PopulateConversationRootAccountIds' do
|
|||
|
||||
PopulateConversationRootAccountIds.up
|
||||
|
||||
cn1.reload.root_account_ids.should eql [a1a.id, a1b.id]
|
||||
cn2.reload.root_account_ids.should eql [a2.id]
|
||||
cn3.reload.root_account_ids.should eql [a3.id]
|
||||
cn4.reload.root_account_ids.should eql [a4.id]
|
||||
cn5.reload.root_account_ids.should eql []
|
||||
expect(cn1.reload.root_account_ids).to eql [a1a.id, a1b.id]
|
||||
expect(cn2.reload.root_account_ids).to eql [a2.id]
|
||||
expect(cn3.reload.root_account_ids).to eql [a3.id]
|
||||
expect(cn4.reload.root_account_ids).to eql [a4.id]
|
||||
expect(cn5.reload.root_account_ids).to eql []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,9 +44,9 @@ describe DataFixup::PopulateGroupCategoryOnDiscussionTopics do
|
|||
DataFixup::PopulateGroupCategoryOnDiscussionTopics.run
|
||||
|
||||
# verify the results
|
||||
topic1.reload.group_category.should == group_category
|
||||
topic1.assignment.reload.group_category.should == group_category
|
||||
topic2.reload.group_category.should be_nil
|
||||
topic3.reload.group_category.should be_nil
|
||||
expect(topic1.reload.group_category).to eq group_category
|
||||
expect(topic1.assignment.reload.group_category).to eq group_category
|
||||
expect(topic2.reload.group_category).to be_nil
|
||||
expect(topic3.reload.group_category).to be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -48,14 +48,14 @@ describe DataFixup::PopulateOverriddenDueAtForDueDateCacher do
|
|||
DataFixup::PopulateOverriddenDueAtForDueDateCacher.run
|
||||
|
||||
@assignment1.reload
|
||||
@assignment1.submissions.size.should eql(0)
|
||||
expect(@assignment1.submissions.size).to eql(0)
|
||||
|
||||
@assignment.reload
|
||||
@assignment.submissions.size.should eql(1)
|
||||
expect(@assignment.submissions.size).to eql(1)
|
||||
@submission = @assignment.submissions.first
|
||||
|
||||
@submission.user.should == @user
|
||||
@submission.assignment.should == @assignment
|
||||
@submission.cached_due_date.should == @due_at
|
||||
expect(@submission.user).to eq @user
|
||||
expect(@submission.assignment).to eq @assignment
|
||||
expect(@submission.cached_due_date).to eq @due_at
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,17 +23,17 @@ describe DataFixup::PopulateSubmissionVersions do
|
|||
it "should not migrate a non-submission version" do
|
||||
wiki_page_model
|
||||
version = Version.create(:versionable => @page, :yaml => @page.attributes.to_yaml)
|
||||
lambda{
|
||||
expect{
|
||||
DataFixup::PopulateSubmissionVersions.run
|
||||
}.should_not change(SubmissionVersion, :count)
|
||||
}.not_to change(SubmissionVersion, :count)
|
||||
end
|
||||
|
||||
it "should not migrate a submission version already having a submission_version" do
|
||||
course_with_student
|
||||
submission = @user.submissions.create(:assignment => @course.assignments.create!)
|
||||
lambda{
|
||||
expect{
|
||||
DataFixup::PopulateSubmissionVersions.run
|
||||
}.should_not change(SubmissionVersion, :count)
|
||||
}.not_to change(SubmissionVersion, :count)
|
||||
end
|
||||
|
||||
it "should migrate all submission version rows without submission_versions" do
|
||||
|
@ -41,11 +41,11 @@ describe DataFixup::PopulateSubmissionVersions do
|
|||
course_with_student
|
||||
submission = @user.submissions.build(:assignment => @course.assignments.create!)
|
||||
submission.without_versioning{ submission.save! }
|
||||
submission.versions.exists?.should be_false
|
||||
expect(submission.versions.exists?).to be_falsey
|
||||
n.times { |x| Version.create(:versionable => submission, :yaml => submission.attributes.to_yaml) }
|
||||
lambda{
|
||||
expect{
|
||||
DataFixup::PopulateSubmissionVersions.run
|
||||
}.should change(SubmissionVersion, :count).by(n)
|
||||
}.to change(SubmissionVersion, :count).by(n)
|
||||
end
|
||||
|
||||
it "should skip submission version rows without a corresponding submission object" do
|
||||
|
@ -55,11 +55,11 @@ describe DataFixup::PopulateSubmissionVersions do
|
|||
Version.create(:versionable => submission, :yaml => submission.attributes.to_yaml)
|
||||
|
||||
submission.reload
|
||||
submission.versions.exists?.should be_true
|
||||
expect(submission.versions.exists?).to be_truthy
|
||||
submission.delete
|
||||
|
||||
lambda{
|
||||
expect{
|
||||
DataFixup::PopulateSubmissionVersions.run
|
||||
}.should_not change(SubmissionVersion, :count)
|
||||
}.not_to change(SubmissionVersion, :count)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ describe 'ReassociateConversationAttachments' do
|
|||
|
||||
# this will set up the conversation attachments folder (and my files folder)
|
||||
u1.conversation_attachments_folder
|
||||
u1.folders.map(&:name).sort.should eql ["conversation attachments", "my files"]
|
||||
expect(u1.folders.map(&:name).sort).to eql ["conversation attachments", "my files"]
|
||||
|
||||
u2 = user
|
||||
cm2 = c.conversation_messages.build
|
||||
|
@ -45,32 +45,32 @@ describe 'ReassociateConversationAttachments' do
|
|||
a2.save_without_touching_context
|
||||
a3 = attachment_obj_with_context(cm2)
|
||||
a3.save_without_touching_context
|
||||
u2.folders.should be_empty
|
||||
expect(u2.folders).to be_empty
|
||||
|
||||
ReassociateConversationAttachments.up
|
||||
|
||||
u1.reload
|
||||
u1.folders.map(&:name).sort.should eql ["conversation attachments", "my files"]
|
||||
u1.conversation_attachments_folder.attachments.should eql [a1]
|
||||
expect(u1.folders.map(&:name).sort).to eql ["conversation attachments", "my files"]
|
||||
expect(u1.conversation_attachments_folder.attachments).to eql [a1]
|
||||
cm1.reload
|
||||
a1.reload
|
||||
cm1.attachment_ids.should eql a1.id.to_s
|
||||
cm1.attachments.should eql [a1]
|
||||
a1.context.should eql u1
|
||||
a1.folder.should eql u1.conversation_attachments_folder
|
||||
expect(cm1.attachment_ids).to eql a1.id.to_s
|
||||
expect(cm1.attachments).to eql [a1]
|
||||
expect(a1.context).to eql u1
|
||||
expect(a1.folder).to eql u1.conversation_attachments_folder
|
||||
|
||||
u2.reload
|
||||
u2.folders.map(&:name).sort.should eql ["conversation attachments", "my files"]
|
||||
u2.conversation_attachments_folder.attachments.map(&:id).sort.should eql [a2.id, a3.id]
|
||||
expect(u2.folders.map(&:name).sort).to eql ["conversation attachments", "my files"]
|
||||
expect(u2.conversation_attachments_folder.attachments.map(&:id).sort).to eql [a2.id, a3.id]
|
||||
cm2.reload
|
||||
a2.reload
|
||||
a3.reload
|
||||
cm2.attachment_ids.split(',').map(&:to_i).sort.should eql [a2.id, a3.id]
|
||||
cm2.attachments.should eql [a2, a3]
|
||||
a2.context.should eql u2
|
||||
a2.folder.should eql u2.conversation_attachments_folder
|
||||
a3.context.should eql u2
|
||||
a3.folder.should eql u2.conversation_attachments_folder
|
||||
expect(cm2.attachment_ids.split(',').map(&:to_i).sort).to eql [a2.id, a3.id]
|
||||
expect(cm2.attachments).to eql [a2, a3]
|
||||
expect(a2.context).to eql u2
|
||||
expect(a2.folder).to eql u2.conversation_attachments_folder
|
||||
expect(a3.context).to eql u2
|
||||
expect(a3.folder).to eql u2.conversation_attachments_folder
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,16 +39,16 @@ describe 'DataFixup::ReintroduceDeletedEntriesToUnreadCount' do
|
|||
|
||||
# run the previous migration, which deletes read status for deleted messages
|
||||
DataFixup::ExcludeDeletedEntriesFromUnreadCount.run
|
||||
@topic.unread_count(@student2).should == 2
|
||||
DiscussionEntryParticipant.find_by_user_id_and_discussion_entry_id(@student2.id, @entry2.id).should be_nil
|
||||
expect(@topic.unread_count(@student2)).to eq 2
|
||||
expect(DiscussionEntryParticipant.find_by_user_id_and_discussion_entry_id(@student2.id, @entry2.id)).to be_nil
|
||||
|
||||
# now the new migration, which marks existing deleted entries as read for all
|
||||
DataFixup::ReintroduceDeletedEntriesToUnreadCount.run
|
||||
@topic.unread_count(@student2).should == 2
|
||||
DiscussionEntryParticipant.find_by_user_id_and_discussion_entry_id(@student2.id, @entry2.id).should be_present
|
||||
@topic.unread_count(@teacher).should == 0
|
||||
@topic2.unread_count(@teacher).should == 0
|
||||
@topic.unread_count(@student1).should == 1
|
||||
@topic2.unread_count(@student1).should == 0
|
||||
expect(@topic.unread_count(@student2)).to eq 2
|
||||
expect(DiscussionEntryParticipant.find_by_user_id_and_discussion_entry_id(@student2.id, @entry2.id)).to be_present
|
||||
expect(@topic.unread_count(@teacher)).to eq 0
|
||||
expect(@topic2.unread_count(@teacher)).to eq 0
|
||||
expect(@topic.unread_count(@student1)).to eq 1
|
||||
expect(@topic2.unread_count(@student1)).to eq 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,7 +32,7 @@ describe 'DataFixup::RemoveBogusEnrollmentAssociatedUserIds' do
|
|||
# ... and erroneously set associated_user_id
|
||||
bad_enrollment.update_attribute(:associated_user_id, @student1.id)
|
||||
bad_enrollment.reload
|
||||
bad_enrollment.associated_user_id.should == @student1.id
|
||||
expect(bad_enrollment.associated_user_id).to eq @student1.id
|
||||
|
||||
# run the fix
|
||||
DataFixup::RemoveBogusEnrollmentAssociatedUserIds.run
|
||||
|
@ -40,7 +40,7 @@ describe 'DataFixup::RemoveBogusEnrollmentAssociatedUserIds' do
|
|||
bad_enrollment.reload
|
||||
|
||||
# verify the results
|
||||
observer_enrollment.associated_user_id.should == @student1.id
|
||||
bad_enrollment.associated_user_id.should be_nil
|
||||
expect(observer_enrollment.associated_user_id).to eq @student1.id
|
||||
expect(bad_enrollment.associated_user_id).to be_nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -39,7 +39,7 @@ describe 'DataFixup::RemoveExtraneousConversationTags' do
|
|||
@conversation.update_attribute :tags, [@course1.asset_string, @course2.asset_string]
|
||||
@cp1.update_attribute :tags, [@course1.asset_string, @course2.asset_string]
|
||||
DataFixup::RemoveExtraneousConversationTags.run
|
||||
@conversation.reload.tags.should eql [@course1.asset_string]
|
||||
expect(@conversation.reload.tags).to eql [@course1.asset_string]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -53,9 +53,9 @@ describe 'DataFixup::RemoveExtraneousConversationTags' do
|
|||
|
||||
DataFixup::RemoveExtraneousConversationTags.fix_private_conversation!(@conversation)
|
||||
|
||||
@conversation.reload.tags.should eql [@course1.asset_string]
|
||||
@cp1.reload.tags.should eql [@course1.asset_string]
|
||||
cmp1.reload.tags.should eql [@course1.asset_string]
|
||||
expect(@conversation.reload.tags).to eql [@course1.asset_string]
|
||||
expect(@cp1.reload.tags).to eql [@course1.asset_string]
|
||||
expect(cmp1.reload.tags).to eql [@course1.asset_string]
|
||||
end
|
||||
|
||||
it "should fix invalid participant tags even if the conversation's tags are correct" do
|
||||
|
@ -66,20 +66,20 @@ describe 'DataFixup::RemoveExtraneousConversationTags' do
|
|||
|
||||
DataFixup::RemoveExtraneousConversationTags.fix_private_conversation!(@conversation)
|
||||
|
||||
@conversation.reload.tags.should eql [@course1.asset_string]
|
||||
@cp1.reload.tags.should eql [@course1.asset_string]
|
||||
cmp1.reload.tags.should eql [@course1.asset_string]
|
||||
expect(@conversation.reload.tags).to eql [@course1.asset_string]
|
||||
expect(@cp1.reload.tags).to eql [@course1.asset_string]
|
||||
expect(cmp1.reload.tags).to eql [@course1.asset_string]
|
||||
end
|
||||
|
||||
it "should do nothing if the tags are already correct" do
|
||||
@cp2.remove_messages :all
|
||||
@cp1.reload.tags.should eql [@course1.asset_string]
|
||||
@cp2.reload.tags.should eql []
|
||||
expect(@cp1.reload.tags).to eql [@course1.asset_string]
|
||||
expect(@cp2.reload.tags).to eql []
|
||||
|
||||
DataFixup::RemoveExtraneousConversationTags.fix_private_conversation!(@conversation)
|
||||
|
||||
@cp1.reload.tags.should eql [@course1.asset_string]
|
||||
@cp2.reload.tags.should eql []
|
||||
expect(@cp1.reload.tags).to eql [@course1.asset_string]
|
||||
expect(@cp2.reload.tags).to eql []
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,19 +74,19 @@ describe 'DataFixup::RemoveMultipleRootFolders' do
|
|||
scope = Folder.where(:context_type => context.class.to_s, :context_id => context)
|
||||
scope.update_all(:parent_folder_id => nil)
|
||||
|
||||
scope.where("workflow_state<>'deleted' AND parent_folder_id IS NULL").count.should == 4
|
||||
expect(scope.where("workflow_state<>'deleted' AND parent_folder_id IS NULL").count).to eq 4
|
||||
end
|
||||
|
||||
DataFixup::RemoveMultipleRootFolders.run(:limit => 2)
|
||||
|
||||
@contexts.each do |c|
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count.should == 1
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count).to eq 1
|
||||
end
|
||||
|
||||
empty_folders.each do |folder|
|
||||
folder.reload
|
||||
folder.workflow_state.should == 'deleted'
|
||||
expect(folder.workflow_state).to eq 'deleted'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -108,21 +108,21 @@ describe 'DataFixup::RemoveMultipleRootFolders' do
|
|||
|
||||
Folder.where(:id => [extra_folder1, extra_folder2]).update_all(:parent_folder_id => nil)
|
||||
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
context.class.to_s, context).count.should == 3
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
context.class.to_s, context).count).to eq 3
|
||||
end
|
||||
|
||||
DataFixup::RemoveMultipleRootFolders.run(:limit => 2)
|
||||
|
||||
@contexts.each do |c|
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count.should == 1
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count).to eq 1
|
||||
end
|
||||
|
||||
extra_folders.each do |folder|
|
||||
folder.reload
|
||||
folder.workflow_state.should_not == 'deleted'
|
||||
folder.parent_folder_id.should == Folder.root_folders(folder.context).first.id
|
||||
expect(folder.workflow_state).not_to eq 'deleted'
|
||||
expect(folder.parent_folder_id).to eq Folder.root_folders(folder.context).first.id
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -155,23 +155,23 @@ describe 'DataFixup::RemoveMultipleRootFolders' do
|
|||
|
||||
Folder.where(:id => [extra_folder1, extra_folder2]).update_all(:parent_folder_id => nil)
|
||||
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
context.class.to_s, context).count.should == 4
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
context.class.to_s, context).count).to eq 4
|
||||
end
|
||||
|
||||
DataFixup::RemoveMultipleRootFolders.run(:limit => 2)
|
||||
|
||||
@contexts.each do |c|
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count.should == 1
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count).to eq 1
|
||||
end
|
||||
|
||||
extra_folders.each do |folder|
|
||||
folder.reload
|
||||
folder.workflow_state.should_not == 'deleted'
|
||||
folder.parent_folder_id.should == Folder.root_folders(folder.context).first.id
|
||||
empty_root_folder_ids.include?(folder.parent_folder_id).should be_false
|
||||
root_folder_ids_with_content.include?(folder.parent_folder_id).should be_true
|
||||
expect(folder.workflow_state).not_to eq 'deleted'
|
||||
expect(folder.parent_folder_id).to eq Folder.root_folders(folder.context).first.id
|
||||
expect(empty_root_folder_ids.include?(folder.parent_folder_id)).to be_falsey
|
||||
expect(root_folder_ids_with_content.include?(folder.parent_folder_id)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -193,29 +193,29 @@ describe 'DataFixup::RemoveMultipleRootFolders' do
|
|||
root_folder_name = get_root_folder_name(context)
|
||||
Folder.where(:id => [extra_folder1, extra_folder2]).update_all(:parent_folder_id => nil)
|
||||
context.folders.find_by_name(root_folder_name).delete
|
||||
context.folders.find_by_name(root_folder_name).should be_nil
|
||||
expect(context.folders.find_by_name(root_folder_name)).to be_nil
|
||||
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
context.class.to_s, context).count.should == 2
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
context.class.to_s, context).count).to eq 2
|
||||
end
|
||||
|
||||
DataFixup::RemoveMultipleRootFolders.run(:limit => 2)
|
||||
|
||||
@contexts.each do |c|
|
||||
Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count.should == 1
|
||||
expect(Folder.where("context_type=? AND context_id=? AND workflow_state<>'deleted' AND parent_folder_id IS NULL",
|
||||
c.class.to_s, c).count).to eq 1
|
||||
|
||||
root_folder_name = get_root_folder_name(c)
|
||||
c.folders.find_by_name(root_folder_name).should_not be_nil
|
||||
expect(c.folders.find_by_name(root_folder_name)).not_to be_nil
|
||||
end
|
||||
|
||||
extra_folders.each do |folder|
|
||||
folder.reload
|
||||
folder.workflow_state.should_not == 'deleted'
|
||||
folder.parent_folder_id.should_not be_nil
|
||||
expect(folder.workflow_state).not_to eq 'deleted'
|
||||
expect(folder.parent_folder_id).not_to be_nil
|
||||
|
||||
root_folder_name = get_root_folder_name(folder.context)
|
||||
folder.parent_folder.name.should == root_folder_name
|
||||
expect(folder.parent_folder.name).to eq root_folder_name
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,6 +14,6 @@ describe DataFixup::RemoveOrphanedContextModuleProgressions do
|
|||
DataFixup::RemoveOrphanedContextModuleProgressions.run
|
||||
|
||||
cmp1.reload
|
||||
lambda { cmp2.reload }.should raise_error(ActiveRecord::RecordNotFound)
|
||||
expect { cmp2.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,8 +31,8 @@ describe 'DataFixup::ResanitizeAssignmentsAllowedExtensions' do
|
|||
|
||||
DataFixup::ResanitizeAssignmentsAllowedExtensions.run
|
||||
|
||||
a1.reload.allowed_extensions.should == []
|
||||
a2.reload.allowed_extensions.should == ['doc', 'xsl']
|
||||
a3.reload.allowed_extensions.should == ['doc', 'xsl']
|
||||
expect(a1.reload.allowed_extensions).to eq []
|
||||
expect(a2.reload.allowed_extensions).to eq ['doc', 'xsl']
|
||||
expect(a3.reload.allowed_extensions).to eq ['doc', 'xsl']
|
||||
end
|
||||
end
|
||||
|
|
|
@ -43,11 +43,11 @@ describe 'DataFixup::ResetUngradedCounts' do
|
|||
@assignment.reload.grade_student(@user, :grade => "0")
|
||||
|
||||
@assignment.reload.update_attribute(:needs_grading_count, 0)
|
||||
Submission.count.should eql 3
|
||||
Enrollment.count.should eql 4
|
||||
expect(Submission.count).to eql 3
|
||||
expect(Enrollment.count).to eql 4
|
||||
|
||||
DataFixup::ResetUngradedCounts.run
|
||||
|
||||
@assignment.reload.needs_grading_count.should eql 1
|
||||
expect(@assignment.reload.needs_grading_count).to eql 1
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,12 +24,12 @@ describe 'DataFixup::SetAccountLtiOpaqueIds' do
|
|||
it "should work" do
|
||||
root_account = Account.default
|
||||
original_guid = root_account.lti_guid
|
||||
original_guid.should_not be_empty
|
||||
expect(original_guid).not_to be_empty
|
||||
|
||||
DataFixup::SetAccountLtiOpaqueIds.run
|
||||
|
||||
root_account.reload
|
||||
root_account.lti_guid.should_not == original_guid
|
||||
expect(root_account.lti_guid).not_to eq original_guid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,7 +34,7 @@ describe 'SetSamlEntityId' do
|
|||
it "should set the entity_id to the current setting if none is set" do
|
||||
SetSamlEntityId.up
|
||||
@aac.reload
|
||||
@aac.entity_id.should == "http://watup_fool.com/saml2"
|
||||
expect(@aac.entity_id).to eq "http://watup_fool.com/saml2"
|
||||
end
|
||||
|
||||
it "should leave the entity_id the same if already set" do
|
||||
|
@ -44,7 +44,7 @@ describe 'SetSamlEntityId' do
|
|||
SetSamlEntityId.up
|
||||
|
||||
@aac.reload
|
||||
@aac.entity_id.should == "haha"
|
||||
expect(@aac.entity_id).to eq "haha"
|
||||
end
|
||||
|
||||
it "should use the account's domain if no config is set" do
|
||||
|
@ -55,7 +55,7 @@ describe 'SetSamlEntityId' do
|
|||
SetSamlEntityId.up
|
||||
|
||||
@aac.reload
|
||||
@aac.entity_id.should == "http://bob.cody.instructure.com/saml2"
|
||||
expect(@aac.entity_id).to eq "http://bob.cody.instructure.com/saml2"
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -38,21 +38,21 @@ describe DataFixup::UndeleteSomeOutcomeAlignments do
|
|||
Rubric.where(:id => @rubric.id).update_all(:data => data.to_yaml)
|
||||
|
||||
ContentTag.where(:id => [align, align2]).update_all(:workflow_state => 'deleted')
|
||||
align.reload.should be_deleted
|
||||
align2.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
expect(align2.reload).to be_deleted
|
||||
|
||||
DataFixup::UndeleteSomeOutcomeAlignments.run
|
||||
align.reload.should_not be_deleted
|
||||
align2.reload.should_not be_deleted
|
||||
expect(align.reload).not_to be_deleted
|
||||
expect(align2.reload).not_to be_deleted
|
||||
end
|
||||
|
||||
it "should not undelete assignments tags that aren't linked to rubrics already undeleted" do
|
||||
align = @rubric_association_object.learning_outcome_alignments.first
|
||||
|
||||
ContentTag.where(:id => align).update_all(:workflow_state => 'deleted')
|
||||
align.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
|
||||
DataFixup::UndeleteSomeOutcomeAlignments.run
|
||||
align.reload.should be_deleted
|
||||
expect(align.reload).to be_deleted
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,20 +23,20 @@ describe 'UnifyActiveAssignmentWorkflowStates' do
|
|||
it "should update the right assignments" do
|
||||
course_with_teacher(:active_all => true)
|
||||
a1 = @course.assignments.create!(:name => 'hi')
|
||||
a1.workflow_state.should == "published"
|
||||
expect(a1.workflow_state).to eq "published"
|
||||
|
||||
a2 = @course.assignments.create!(:name => 'hi')
|
||||
Assignment.where(:id => a2.id).update_all(:workflow_state => "available")
|
||||
a2.reload.workflow_state.should == "available"
|
||||
expect(a2.reload.workflow_state).to eq "available"
|
||||
|
||||
a3 = @course.assignments.create!(:name => 'hi')
|
||||
a3.destroy
|
||||
a3.workflow_state.should == "deleted"
|
||||
expect(a3.workflow_state).to eq "deleted"
|
||||
|
||||
UnifyActiveAssignmentWorkflowStates.up
|
||||
|
||||
a1.reload.workflow_state.should == "published"
|
||||
a2.reload.workflow_state.should == "published"
|
||||
a3.reload.workflow_state.should == "deleted"
|
||||
expect(a1.reload.workflow_state).to eq "published"
|
||||
expect(a2.reload.workflow_state).to eq "published"
|
||||
expect(a3.reload.workflow_state).to eq "deleted"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue