RuboCop: Style/NumericLiterals

[skip-stages=Flakey]

auto-corrected

Change-Id: I88363d87d5a70be941aa81b4ffe5306ce7506b98
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279207
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2021-11-22 11:12:47 -07:00
parent d5276227b1
commit eaca556b81
153 changed files with 337 additions and 348 deletions

View File

@ -446,9 +446,6 @@ Style/ModuleFunction:
Style/MultipleComparison:
Severity: convention
AutoCorrect: false
Style/NumericLiterals:
Enabled: false
AutoCorrect: false
Style/OptionalArguments:
Severity: convention
Style/OptionalBooleanParameter:

View File

@ -159,7 +159,7 @@ class Login::CanvasController < ApplicationController
flash[:error] = if mobile_device?
message
else
{ html: message, timeout: 15000 }
{ html: message, timeout: 15_000 }
end
@errored = true
@headers = false

View File

@ -218,7 +218,7 @@ class Assignment < ActiveRecord::Base
end
def reasonable_points_possible?
return if points_possible.to_i < 1000000000
return if points_possible.to_i < 1_000_000_000
return unless points_possible_changed?
errors.add(

View File

@ -113,10 +113,10 @@ class Attachments::S3Storage
if block_given?
File.open(tempfile.path, 'rb') do |file|
chunk = file.read(64000)
chunk = file.read(64_000)
while chunk
yield chunk
chunk = file.read(64000)
chunk = file.read(64_000)
end
end
end

View File

@ -56,7 +56,7 @@ class Quizzes::Quiz < ActiveRecord::Base
validates :title, length: { :maximum => maximum_string_length, :allow_nil => true }
validates :context_id, presence: true
validates :context_type, presence: true
validates :points_possible, numericality: { less_than_or_equal_to: 2000000000, allow_nil: true }
validates :points_possible, numericality: { less_than_or_equal_to: 2_000_000_000, allow_nil: true }
validate :validate_quiz_type, :if => :quiz_type_changed?
validate :validate_ip_filter, :if => :ip_filter_changed?
validate :validate_hide_results, :if => :hide_results_changed?

View File

@ -63,7 +63,7 @@ class Quizzes::QuizExtension
if ext_params[:extra_time]
# limit to a week
quiz_submission.extra_time = [ext_params[:extra_time].to_i.abs, 10080].min
quiz_submission.extra_time = [ext_params[:extra_time].to_i.abs, 10_080].min
end
# false is a valid value, so explicitly check nil

View File

@ -103,10 +103,10 @@ class Quizzes::QuizQuestion::AnswerGroup
return suggested_id
end
id = rand(10000)
id = rand(10_000)
while taken_ids.include?(id)
id = rand(10000)
id = rand(10_000)
end
id

View File

@ -110,7 +110,7 @@ class Quizzes::QuizStatistics::ItemAnalysis::Item
end
def sort_key
[question[:position] || 10000, question_text, question[:id], -all_respondents.size]
[question[:position] || 10_000, question_text, question[:id], -all_respondents.size]
end
private

View File

@ -33,12 +33,12 @@ class Quizzes::QuizSubmission < ActiveRecord::Base
validates :quiz_id, presence: true
validates :extra_time, numericality: { greater_than_or_equal_to: 0,
less_than_or_equal_to: 10080, # one week
less_than_or_equal_to: 10_080, # one week
allow_nil: true }
validates :extra_attempts, numericality: { greater_than_or_equal_to: 0,
less_than_or_equal_to: 1000,
allow_nil: true }
validates :quiz_points_possible, numericality: { less_than_or_equal_to: 2000000000,
validates :quiz_points_possible, numericality: { less_than_or_equal_to: 2_000_000_000,
allow_nil: true }
before_validation :update_quiz_points_possible

View File

@ -41,7 +41,7 @@ class ReportSnapshot < ActiveRecord::Base
report['weekly'].each do |week|
next unless week[key]
stamp = (week['week'] * 604800) + ((week['year'] - 1970) * 31556926)
stamp = (week['week'] * 604_800) + ((week['year'] - 1970) * 31_556_926)
next if stamp > now
items << [stamp * 1000, week[key]]

View File

@ -250,7 +250,7 @@ class Rubric < ActiveRecord::Base
def unique_item_id(id = nil)
@used_ids ||= {}
while !id || @used_ids[id]
id = "#{rubric_id || self.id}_#{rand(10000)}"
id = "#{rubric_id || self.id}_#{rand(10_000)}"
end
@used_ids[id] = true
id

View File

@ -34,7 +34,7 @@ class WebConference < ActiveRecord::Base
validates :conference_type, :title, :context_id, :context_type, :user_id, presence: true
validate :lti_tool_valid, if: -> { conference_type == 'LtiConference' }
MAX_DURATION = 99999999
MAX_DURATION = 99_999_999
validates :duration, numericality: { :less_than_or_equal_to => MAX_DURATION, :allow_nil => true }
before_validation :infer_conference_details

View File

@ -83,7 +83,7 @@ class Submission::ShowPresenter
end
def submission_preview_frame_url
submission_data_url(preview: 1, rand: rand(999999))
submission_data_url(preview: 1, rand: rand(999_999))
end
def comment_attachment_download_url(submission_comment:, attachment:)

View File

@ -203,7 +203,7 @@ module CanvasRails
configure_connection
raise "Canvas requires PostgreSQL 12 or newer" unless postgresql_version >= 12_00_00
raise "Canvas requires PostgreSQL 12 or newer" unless postgresql_version >= 12_00_00 # rubocop:disable Style/NumericLiterals
break
rescue ::PG::Error => e

View File

@ -92,7 +92,7 @@ module PostgreSQLAdapterExtensions
# have max length validations in the models.
def type_to_sql(type, limit: nil, **)
if type == :text && limit
if limit <= 10485760
if limit <= 10_485_760
type = :string
else
limit = nil
@ -293,7 +293,7 @@ module PostgreSQLAdapterExtensions
end
def icu_collations
return [] if postgresql_version < 120000
return [] if postgresql_version < 12_00_00 # rubocop:disable Style/NumericLiterals
@collations ||= select_rows <<~SQL.squish, "SCHEMA"
SELECT nspname, collname
@ -307,7 +307,7 @@ module PostgreSQLAdapterExtensions
end
def create_icu_collations
return if postgresql_version < 120000
return if postgresql_version < 12_00_00 # rubocop:disable Style/NumericLiterals
original_locale = I18n.locale

View File

@ -442,7 +442,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "assignments", :force => true do |t|
t.string "title", limit: 255
t.text "description", :limit => 16777215
t.text "description", :limit => 16_777_215
t.datetime "due_at"
t.datetime "unlock_at"
t.datetime "lock_at"
@ -569,7 +569,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "calendar_events", :force => true do |t|
t.string "title", limit: 255
t.text "description", :limit => 16777215
t.text "description", :limit => 16_777_215
t.string "location_name", limit: 255
t.string "location_address", limit: 255
t.datetime "start_at"
@ -1041,7 +1041,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "show_public_context_messages"
t.text "syllabus_body", :limit => 16777215
t.text "syllabus_body", :limit => 16_777_215
t.boolean "allow_student_forum_attachments", :default => false
t.string "default_wiki_editing_roles", limit: 255
t.integer "wiki_id", :limit => 8
@ -1225,7 +1225,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "discussion_topics", :force => true do |t|
t.string "title", limit: 255
t.text "message", :limit => 16777215
t.text "message", :limit => 16_777_215
t.integer "context_id", :limit => 8, :null => false
t.string "context_type", :null => false, limit: 255
t.string "type", limit: 255
@ -1424,7 +1424,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.boolean "allow_comments"
t.boolean "show_comments"
t.string "slug", limit: 255
t.text "content", :limit => 16777215
t.text "content", :limit => 16_777_215
t.datetime "created_at"
t.datetime "updated_at"
end
@ -1467,7 +1467,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.boolean "during_tests", :default => false
t.text "user_agent"
t.string "request_method", limit: 255
t.text "http_env", :limit => 16777215
t.text "http_env", :limit => 16_777_215
t.string "subject", limit: 255
t.string "request_context_id", limit: 255
t.integer "account_id", :limit => 8
@ -2515,11 +2515,11 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "quiz_id", :limit => 8, :null => false
t.integer "quiz_version"
t.integer "user_id", :limit => 8
t.text "submission_data", :limit => 16777215
t.text "submission_data", :limit => 16_777_215
t.integer "submission_id", :limit => 8
t.float "score"
t.float "kept_score"
t.text "quiz_data", :limit => 16777215
t.text "quiz_data", :limit => 16_777_215
t.datetime "started_at"
t.datetime "end_at"
t.datetime "finished_at"
@ -2552,8 +2552,8 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "quizzes", :force => true do |t|
t.string "title", limit: 255
t.text "description", :limit => 16777215
t.text "quiz_data", :limit => 16777215
t.text "description", :limit => 16_777_215
t.text "quiz_data", :limit => 16_777_215
t.float "points_possible"
t.integer "context_id", :limit => 8, :null => false
t.string "context_type", :null => false, limit: 255
@ -2602,7 +2602,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "report_snapshots", :force => true do |t|
t.string "report_type", limit: 255
t.text "data", :limit => 16777215
t.text "data", :limit => 16_777_215
t.datetime "created_at"
t.datetime "updated_at"
t.integer "account_id", :limit => 8
@ -2763,8 +2763,8 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.datetime "updated_at"
t.integer "attachment_id", :limit => 8
t.integer "progress"
t.text "processing_errors", :limit => 16777215
t.text "processing_warnings", :limit => 16777215
t.text "processing_errors", :limit => 16_777_215
t.text "processing_warnings", :limit => 16_777_215
t.boolean "batch_mode"
t.integer "batch_mode_term_id", :limit => 8
t.text "options"
@ -2876,7 +2876,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
:unique => true
create_table "submissions", :force => true do |t|
t.text "body", :limit => 16777215
t.text "body", :limit => 16_777_215
t.string "url", limit: 255
t.integer "attachment_id", :limit => 8
t.string "grade", limit: 255
@ -3063,7 +3063,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.boolean "show_user_services", :default => true
t.string "gender", limit: 255
t.integer "page_views_count", :default => 0
t.integer "reminder_time_for_due_dates", :default => 172800
t.integer "reminder_time_for_due_dates", :default => 172_800
t.integer "reminder_time_for_grading", :default => 0
t.integer "storage_quota", :limit => 8
t.string "visible_inbox_types", limit: 255
@ -3137,7 +3137,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
t.integer "versionable_id", :limit => 8
t.string "versionable_type", limit: 255
t.integer "number"
t.text "yaml", :limit => 16777215
t.text "yaml", :limit => 16_777_215
t.datetime "created_at"
end
@ -3185,7 +3185,7 @@ class InitCanvasDb < ActiveRecord::Migration[4.2]
create_table "wiki_pages", :force => true do |t|
t.integer "wiki_id", :limit => 8, :null => false
t.string "title", limit: 255
t.text "body", :limit => 16777215
t.text "body", :limit => 16_777_215
t.string "workflow_state", :null => false, limit: 255
t.integer "user_id", :limit => 8
t.datetime "created_at"

View File

@ -131,7 +131,7 @@ class CreateDelayedJobs < ActiveRecord::Migration[4.2]
create_table :failed_jobs do |t|
t.integer "priority", :default => 0
t.integer "attempts", :default => 0
t.string "handler", :limit => 512000
t.string "handler", :limit => 512_000
t.text "last_error"
t.string "queue", limit: 255
t.datetime "run_at"

View File

@ -23,7 +23,7 @@ class ChangeSubmissionCommentDraftDefault < ActiveRecord::Migration[4.2]
def up
change_column_default(:submission_comments, :draft, false)
DataFixup::BackfillNulls.run(SubmissionComment, :draft, default_value: false, batch_size: 10000)
DataFixup::BackfillNulls.run(SubmissionComment, :draft, default_value: false, batch_size: 10_000)
end
def down

View File

@ -21,7 +21,7 @@ class ModifySubmissionAndQuizSubmissionUserForeignKeyConstraint < ActiveRecord::
tag :predeploy
def up
if connection.send(:postgresql_version) >= 90400
if connection.send(:postgresql_version) >= 9_04_00 # rubocop:disable Style/NumericLiterals
alter_constraint(:submissions, find_foreign_key(:submissions, :users), new_name: 'fk_rails_8d85741475', deferrable: true)
alter_constraint(:quiz_submissions, find_foreign_key(:quiz_submissions, :users), new_name: 'fk_rails_04850db4b4', deferrable: true)
else
@ -33,7 +33,7 @@ class ModifySubmissionAndQuizSubmissionUserForeignKeyConstraint < ActiveRecord::
end
def down
if connection.send(:postgresql_version) >= 90400
if connection.send(:postgresql_version) >= 9_04_00 # rubocop:disable Style/NumericLiterals
alter_constraint(:submissions, 'fk_rails_8d85741475', deferrable: false)
alter_constraint(:quiz_submissions, 'fk_rails_04850db4b4', deferrable: false)
else

View File

@ -24,7 +24,7 @@ class AddIndexToSubmissionsGradedAt < ActiveRecord::Migration[5.0]
def change
# brin indexes are only available on Postgres versions 9.5+
if connection.send(:postgresql_version) >= 90500
if connection.send(:postgresql_version) >= 9_05_00 # rubocop:disable Style/NumericLiterals
add_index :submissions, :graded_at, algorithm: :concurrently, using: :brin
else
add_index :submissions, :graded_at, algorithm: :concurrently

View File

@ -4,7 +4,7 @@ class RenameSwitchmanShardsFkIfNecessary < ActiveRecord::Migration[5.1]
tag :predeploy
def up
if connection.send(:postgresql_version) >= 90400
if connection.send(:postgresql_version) >= 9_04_00 # rubocop:disable Style/NumericLiterals
alter_constraint(:switchman_shards, find_foreign_key(:switchman_shards, :switchman_shards, column: :delayed_jobs_shard_id), new_name: 'fk_rails_45bd80a9c8')
else
remove_foreign_key :switchman_shards, column: :delayed_jobs_shard_id, if_exists: true

View File

@ -21,7 +21,7 @@ class CreatePg12Collations < ActiveRecord::Migration[4.2]
tag :predeploy
def self.runnable?
connection.postgresql_version >= 120000
connection.postgresql_version >= 12_00_00 # rubocop:disable Style/NumericLiterals
end
def up

View File

@ -22,7 +22,7 @@ class SwitchToPg12CollationIndexes < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def self.runnable?
connection.postgresql_version >= 120000
connection.postgresql_version >= 12_00_00 # rubocop:disable Style/NumericLiterals
end
def up

View File

@ -21,7 +21,7 @@ class AddRedoRequestToSubmissions < ActiveRecord::Migration[5.2]
tag :predeploy
def up
if connection.postgresql_version >= 110000
if connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
remove_column :submissions, :redo_request, if_exists: true # rubocop:disable Migration/RemoveColumn column replaced transactionally
add_column :submissions, :redo_request, :boolean, default: false, null: false
else

View File

@ -22,7 +22,7 @@ class BackfillSubmissionsRedoRequest < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def self.runnable?
connection.postgresql_version < 110000
connection.postgresql_version < 11_00_00 # rubocop:disable Style/NumericLiterals
end
def up

View File

@ -22,7 +22,7 @@ class AddCourseTemplateColumns < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
new_pg = connection.postgresql_version >= 110000
new_pg = connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
defaults = new_pg ? { default: false, null: false } : {}
add_column :courses, :template, :boolean, if_not_exists: true, **defaults

View File

@ -23,7 +23,7 @@ class AddWorkflowStateToLearningOutcomeResult < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
if connection.postgresql_version >= 110000
if connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
add_column :learning_outcome_results, :workflow_state, :string, default: 'active', null: false, if_not_exists: true
else
add_column :learning_outcome_results, :workflow_state, :string, if_not_exists: true

View File

@ -22,7 +22,7 @@ class AddHomeroomCourseColumns < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
new_pg = connection.postgresql_version >= 110000
new_pg = connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
defaults = new_pg ? { default: false, null: false } : {}
add_column :courses, :homeroom_course, :boolean, if_not_exists: true, **defaults

View File

@ -21,7 +21,7 @@ class AddImportantDatesColumns < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
new_pg = connection.postgresql_version >= 110000
new_pg = connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
defaults = new_pg ? { default: false, null: false } : {}
add_column :assignments, :important_dates, :boolean, if_not_exists: true, **defaults

View File

@ -22,7 +22,7 @@ class AddLegacyToDiscussionEntry < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
new_pg = connection.postgresql_version >= 110000
new_pg = connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
defaults = new_pg ? { default: true, null: false } : {}
add_column :discussion_entries, :legacy, :boolean, if_not_exists: true, **defaults

View File

@ -22,7 +22,7 @@ class AddIncludeReplyPreviewToDiscussionEntry < ActiveRecord::Migration[6.0]
disable_ddl_transaction!
def up
new_pg = connection.postgresql_version >= 110000
new_pg = connection.postgresql_version >= 11_00_00 # rubocop:disable Style/NumericLiterals
defaults = new_pg ? { default: false, null: false } : {}
add_column :discussion_entries, :include_reply_preview, :boolean, if_not_exists: true, **defaults

View File

@ -20,7 +20,7 @@
module CanvasDynamoDB
class Database
DEFAULT_MIN_CAPACITY = 5
DEFAULT_MAX_CAPACITY = 10000
DEFAULT_MAX_CAPACITY = 10_000
attr_reader :client, :fingerprint, :logger

View File

@ -215,7 +215,7 @@ describe CanvasKaltura::ClientV3 do
describe "startSession" do
it "sends Kaltura a request with proper parameters for a user" do
user_id = 12345
user_id = 12_345
session_type = CanvasKaltura::SessionType::USER
kaltura_stub = stub_kaltura_session(
@ -268,7 +268,7 @@ describe CanvasKaltura::ClientV3 do
describe "mediaGet" do
it "calls getRequest with proper parameters" do
entry_id = 12345
entry_id = 12_345
expect(@kaltura).to receive(:getRequest).with(
:media, :get, { :ks => nil, :entryId => entry_id }
@ -292,12 +292,12 @@ describe CanvasKaltura::ClientV3 do
expect(@kaltura).to receive(:getRequest).with(
:media, :update, {
:ks => nil,
:entryId => 12345,
:entryId => 12_345,
'mediaEntry:key' => 'value'
}
).and_return(double(:children => []))
@kaltura.mediaUpdate(12345, { "key" => "value" })
@kaltura.mediaUpdate(12_345, { "key" => "value" })
end
it "returns a properly formatted item" do
@ -313,10 +313,10 @@ describe CanvasKaltura::ClientV3 do
describe "mediaDelete" do
it "calls getRequest with proper parameters" do
expect(@kaltura).to receive(:getRequest).with(
:media, :delete, { :ks => nil, :entryId => 12345 }
:media, :delete, { :ks => nil, :entryId => 12_345 }
)
@kaltura.mediaDelete(12345)
@kaltura.mediaDelete(12_345)
end
end

View File

@ -24,7 +24,7 @@ describe CanvasSecurity::PageViewJwt do
describe ".generate" do
it "generates and decodes a valid jwt token" do
created_at = DateTime.now
uid = 1065040302011
uid = 1_065_040_302_011
attributes = {
request_id: "abcdefg-1234566",
user_id: uid,

View File

@ -111,7 +111,7 @@ module CanvasSecurity
it "expires in an hour" do
Timecop.freeze(Time.utc(2013, 3, 13, 9, 12)) do
jwt = ServicesJwt.new(jwt_string, false)
expect(jwt.expires_at).to eq(1363169520)
expect(jwt.expires_at).to eq(1_363_169_520)
end
end

View File

@ -53,7 +53,7 @@ class CanvasUnzip
warnings[tag] << entry.name
end
BUFFER_SIZE = 65536
BUFFER_SIZE = 65_536
DEFAULT_BYTE_LIMIT = 50 << 30
def self.default_limits(file_size)
# * maximum byte count is, unless specified otherwise,

View File

@ -79,7 +79,7 @@ describe EventStream::IndexStrategy::Cassandra do
before do
@id = double('id', :to_s => '1234567890')
@key = "key_value"
@timestamp = double('timestamp', :to_i => 12345)
@timestamp = double('timestamp', :to_i => 12_345)
@record = double('record', :id => @id, :created_at => @timestamp)
end

View File

@ -30,8 +30,8 @@ module LtiAdvantage::Messages
azp: '163440e5-1c75-4c28-a07c-43e8a9cd3110',
sub: '7da708b6-b6cf-483b-b899-11831c685b6f',
deployment_id: 'ee493d2e-9f2e-4eca-b2a0-122413887caa',
iat: 1529681618,
exp: 1529681634,
iat: 1_529_681_618,
exp: 1_529_681_634,
iss: 'https://platform.example.edu',
nonce: '5a234202-6f0e-413d-8793-809db7a95930',
deep_linking_settings: LtiAdvantage::Models::DeepLinkingSetting.new(
@ -106,8 +106,8 @@ module LtiAdvantage::Messages
azp: '163440e5-1c75-4c28-a07c-43e8a9cd3110',
sub: '7da708b6-b6cf-483b-b899-11831c685b6f',
deployment_id: 'ee493d2e-9f2e-4eca-b2a0-122413887caa',
iat: 1529681618,
exp: 1529681634,
iat: 1_529_681_618,
exp: 1_529_681_634,
iss: 'https://platform.example.edu',
nonce: '5a234202-6f0e-413d-8793-809db7a95930',
deep_linking_settings: LtiAdvantage::Models::DeepLinkingSetting.new(

View File

@ -30,8 +30,8 @@ module LtiAdvantage::Messages
azp: '163440e5-1c75-4c28-a07c-43e8a9cd3110',
sub: '7da708b6-b6cf-483b-b899-11831c685b6f',
deployment_id: 'ee493d2e-9f2e-4eca-b2a0-122413887caa',
iat: 1529681618,
exp: 1529681634,
iat: 1_529_681_618,
exp: 1_529_681_634,
iss: 'https://platform.example.edu',
nonce: '5a234202-6f0e-413d-8793-809db7a95930',
resource_link: LtiAdvantage::Claims::ResourceLink.new(id: 1),
@ -104,8 +104,8 @@ module LtiAdvantage::Messages
azp: '163440e5-1c75-4c28-a07c-43e8a9cd3110',
sub: '7da708b6-b6cf-483b-b899-11831c685b6f',
deployment_id: 'ee493d2e-9f2e-4eca-b2a0-122413887caa',
iat: 1529681618,
exp: 1529681634,
iat: 1_529_681_618,
exp: 1_529_681_634,
iss: 'https://platform.example.edu',
nonce: '5a234202-6f0e-413d-8793-809db7a95930',
resource_link: LtiAdvantage::Claims::ResourceLink.new(id: 1),

View File

@ -38,13 +38,13 @@ describe "report helper" do
# default min
expect(report.number_of_items_per_runner(1)).to eq 25
# divided by 99 to make for 100 jobs except for when exactly divisible by 99
expect(report.number_of_items_per_runner(13001)).to eq 131
expect(report.number_of_items_per_runner(13_001)).to eq 131
# default max
expect(report.number_of_items_per_runner(1801308213)).to eq 1000
expect(report.number_of_items_per_runner(1_801_308_213)).to eq 1000
# override min
expect(report.number_of_items_per_runner(100, min: 10)).to eq 10
# override max
expect(report.number_of_items_per_runner(109213081, max: 100)).to eq 100
expect(report.number_of_items_per_runner(109_213_081, max: 100)).to eq 100
end
it 'creates report runners with a single trip' do

View File

@ -105,7 +105,7 @@ module RequestContext
match = header_val.match(/t=(?<req_start>\d+)/)
return unless match
delta = (Time.now.utc.to_f * 1000000).to_i - match['req_start'].to_i
delta = (Time.now.utc.to_f * 1_000_000).to_i - match['req_start'].to_i
RequestContext::Generator.add_meta_header("q", delta)
end
end

View File

@ -119,12 +119,12 @@ describe "RequestContext::Generator" do
it "calculates the 'queued' time if header is passed" do
Timecop.freeze do
Thread.current[:context] = nil
env['HTTP_X_REQUEST_START'] = "t=#{(1.minute.ago.to_f * 1000000).to_i}"
env['HTTP_X_REQUEST_START'] = "t=#{(1.minute.ago.to_f * 1_000_000).to_i}"
_, headers, = RequestContext::Generator.new(lambda do |_env|
[200, {}, []]
end).call(env)
q = headers["X-Canvas-Meta"].match(/q=(\d+)/)[1].to_f
expect(q / 1000000).to eq 60.0
expect(q / 1_000_000).to eq 60.0
end
end

View File

@ -132,7 +132,7 @@ module BrandableCSS
migration = migrations.find { |m| m.name == MIGRATION_NAME + pre_or_post.camelize }
# they can't have the same id, so we just add 1 to the postdeploy one
expected_version = (pre_or_post == 'predeploy') ? migration_version : (migration_version + 1)
raise BrandConfigWithOutCompileAssets if expected_version == 85663486644871658581990
raise BrandConfigWithOutCompileAssets if expected_version == 85_663_486_644_871_658_581_990
raise DefaultMD5NotUpToDateError unless migration && migration.version == expected_version
end
end

View File

@ -44,7 +44,7 @@ module Canvas
# calling Canvas::Apm.annotate_trace() with the shard and account
# will provide the facets useful for searching by in the aggregation client.
module Apm
HOST_SAMPLING_INTERVAL = 10000
HOST_SAMPLING_INTERVAL = 10_000
class << self
attr_writer :enable_debug_mode, :hostname, :tracer
attr_accessor :canvas_cluster

View File

@ -27,7 +27,7 @@ module Canvas
class Info
attr_reader :req, :account, :user, :rci, :type
MAX_DATA_SIZE = 65535
MAX_DATA_SIZE = 65_535
def initialize(request, root_account, user, opts = {})
@req = request

View File

@ -75,7 +75,7 @@ module Canvas::Migration
content_migration.id.to_s
end
else
"data_#{rand(10000)}" # should only happen in testing
"data_#{rand(10_000)}" # should only happen in testing
end
"#{QUIZ_FILE_DIRECTORY}/#{key}"
end
@ -104,7 +104,7 @@ module Canvas::Migration
slug = if @settings[:content_migration_id] && @settings[:user_id]
"cm_#{@settings[:content_migration_id]}_user_id_#{@settings[:user_id]}_#{@settings[:migration_type]}"
else
"export_#{rand(10000)}"
"export_#{rand(10_000)}"
end
path = create_export_dir(slug)

View File

@ -52,7 +52,7 @@ class CanvasLogger < ActiveSupport::Logger
@log_path = log_path
old_logdev = @logdev
@logdev = ::Logger::LogDevice.new(log_path, :shift_age => 0, :shift_size => 1048576)
@logdev = ::Logger::LogDevice.new(log_path, :shift_age => 0, :shift_size => 1_048_576)
old_logdev.close
end

View File

@ -44,7 +44,7 @@ require 'ipaddr'
class CutyCapt
CUTYCAPT_DEFAULTS = {
:delay => 3000,
:timeout => 60000,
:timeout => 60_000,
:ip_blacklist => ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16', '169.254.169.254', '127.0.0.0/8'],
:domain_blacklist => [],
:allowed_schemes => ['http', 'https'],

View File

@ -21,7 +21,7 @@
module DataFixup::DeleteInvalidCommunicationChannels
def self.run
scope = CommunicationChannel.where(path_type: CommunicationChannel::TYPE_EMAIL)
scope.find_ids_in_ranges(batch_size: 10000) do |min_id, max_id|
scope.find_ids_in_ranges(batch_size: 10_000) do |min_id, max_id|
records = scope.where(id: min_id..max_id).pluck(:id, :user_id, :path).reject do |_id, _user_id, path|
EmailAddressValidator.valid?(path)
end

View File

@ -20,7 +20,7 @@
module DataFixup
module FixPointsPossibleSumsInQuizzes
def self.run
Quizzes::Quiz.find_ids_in_ranges(:batch_size => 10000) do |min_id, max_id|
Quizzes::Quiz.find_ids_in_ranges(:batch_size => 10_000) do |min_id, max_id|
affected_quizzes.where(id: min_id..max_id).find_each do |quiz|
possible = Quizzes::Quiz.count_points_possible(quiz.root_entries(true))
quiz.update!(points_possible: possible)

View File

@ -59,7 +59,7 @@ module DataFixup::PopulateMissingRootAccountIdsIfSingleRootAccountInstall
end
def populate_nils_on_table(model, field_name, fill_with)
while model.where(field_name => nil).limit(10000).update_all(field_name => fill_with) > 0
while model.where(field_name => nil).limit(10_000).update_all(field_name => fill_with) > 0
end
end
@ -68,7 +68,7 @@ module DataFixup::PopulateMissingRootAccountIdsIfSingleRootAccountInstall
# key to be a little safer.
sa_id = Account.site_admin.id
loop do
ids = DeveloperKey.where(root_account_id: nil, account_id: nil).limit(10000).pluck(:id)
ids = DeveloperKey.where(root_account_id: nil, account_id: nil).limit(10_000).pluck(:id)
break if ids.empty?
DeveloperKey.where(id: ids).update_all(root_account_id: sa_id)

View File

@ -52,7 +52,7 @@ describe LtiApiController, type: :request do
let(:request_body) do
{
"paperid" => 200505101,
"paperid" => 200_505_101,
"outcomes_tool_placement_url" => "https://sandbox.turnitin.com/api/lti/1p0/outcome_tool_data/200505101?lang=en_us",
"lis_result_sourcedid" => Lti::LtiOutboundAdapter.new(tool, lti_student, lti_course).encode_source_id(lti_assignment)
}

View File

@ -644,7 +644,7 @@ module Api
before do
@sis_id = 1357
@batch = 991357
@batch = 991_357
@has_right = false
end

View File

@ -1192,9 +1192,9 @@ describe CoursesController, type: :request do
it "sets the storage quota" do
json = api_call(:post, @resource_path,
@resource_params,
{ :account_id => @account.id, :course => { :storage_quota_mb => 12345 } })
{ :account_id => @account.id, :course => { :storage_quota_mb => 12_345 } })
new_course = Course.find(json['id'])
expect(new_course.storage_quota_mb).to eq 12345
expect(new_course.storage_quota_mb).to eq 12_345
end
context "without :manage_storage_quotas" do
@ -1210,7 +1210,7 @@ describe CoursesController, type: :request do
it "ignores storage_quota" do
json = api_call(:post, @resource_path,
@resource_params,
{ :account_id => @account.id, :course => { :storage_quota => 12345 } })
{ :account_id => @account.id, :course => { :storage_quota => 12_345 } })
new_course = Course.find(json['id'])
expect(new_course.storage_quota).to eq @account.default_storage_quota
end
@ -1218,7 +1218,7 @@ describe CoursesController, type: :request do
it "ignores storage_quota_mb" do
json = api_call(:post, @resource_path,
@resource_params,
{ :account_id => @account.id, :course => { :storage_quota_mb => 12345 } })
{ :account_id => @account.id, :course => { :storage_quota_mb => 12_345 } })
new_course = Course.find(json['id'])
expect(new_course.storage_quota_mb).to eq @account.default_storage_quota_mb
end
@ -1237,7 +1237,7 @@ describe CoursesController, type: :request do
it "ignores storage_quota" do
json = api_call(:post, @resource_path,
@resource_params,
{ :account_id => @account.id, :course => { :storage_quota => 12345 } })
{ :account_id => @account.id, :course => { :storage_quota => 12_345 } })
new_course = Course.find(json['id'])
expect(new_course.storage_quota).to eq @account.default_storage_quota
end
@ -1245,7 +1245,7 @@ describe CoursesController, type: :request do
it "ignores storage_quota_mb" do
json = api_call(:post, @resource_path,
@resource_params,
{ :account_id => @account.id, :course => { :storage_quota_mb => 12345 } })
{ :account_id => @account.id, :course => { :storage_quota_mb => 12_345 } })
new_course = Course.find(json['id'])
expect(new_course.storage_quota_mb).to eq @account.default_storage_quota_mb
end

View File

@ -659,7 +659,7 @@ describe Quizzes::QuizSubmissionsApiController, type: :request do
it 'requires the current attempt index' do
qs_api_complete true, {
attempt: 123123123
attempt: 123_123_123
}
assert_status(400)

View File

@ -90,7 +90,7 @@ describe "Services API", type: :request do
'kaltura_setting' => {
'domain' => 'kaltura.example.com',
'kcw_ui_conf' => '1',
"max_file_size_bytes" => 534773760,
"max_file_size_bytes" => 534_773_760,
'partner_id' => '100',
'player_ui_conf' => '1',
'resource_domain' => 'cdn.kaltura.example.com',

View File

@ -1112,7 +1112,7 @@ describe 'Submissions API', type: :request do
expect(mock_kaltura).to receive(:media_sources).and_return([{ :height => "240", :bitrate => "382", :isOriginal => "0", :width => "336", :content_type => "video/mp4",
:containerFormat => "isom", :url => "https://kaltura.example.com/some/url", :size => "204", :fileExt => "mp4" }])
submit_homework(a1, student1, submission_type: 'online_text_entry', media_comment_id: 54321, media_comment_type: "video")
submit_homework(a1, student1, submission_type: 'online_text_entry', media_comment_id: 54_321, media_comment_type: "video")
stub_kaltura
json = api_call(:get,
"/api/v1/courses/#{@course.id}/assignments/#{a1.id}/submissions.json",
@ -4548,41 +4548,41 @@ describe 'Submissions API', type: :request do
it "allows a teacher to upload files for a student" do
@user = @teacher
preflight(name: 'test.txt', size: 12345, content_type: 'text/plain')
preflight(name: 'test.txt', size: 12_345, content_type: 'text/plain')
assert_status(200)
end
it "allows any filetype when there are no restrictions on type" do
preflight(name: 'test.txt', size: 12345, content_type: 'text/plain')
preflight(name: 'test.txt', size: 12_345, content_type: 'text/plain')
assert_status(200)
end
it "rejects uploading files when file extension is not given" do
@assignment.update(allowed_extensions: ['jpg'])
preflight(name: 'name', size: 12345)
preflight(name: 'name', size: 12_345)
assert_status(400)
end
it "rejects uploading files when filetype is not allowed" do
@assignment.update(:allowed_extensions => ['doc'])
preflight(name: 'test.txt', size: 12345, content_type: 'text/plain')
preflight(name: 'test.txt', size: 12_345, content_type: 'text/plain')
assert_status(400)
end
it "allows filetype when restricted and is correct filetype" do
@assignment.update(:allowed_extensions => ['txt'])
preflight(name: 'test.txt', size: 12345, content_type: 'text/plain')
preflight(name: 'test.txt', size: 12_345, content_type: 'text/plain')
assert_status(200)
end
it "falls back to parsing the extension when an unknown type" do
@assignment.update(:allowed_extensions => ['beepboop'])
preflight(name: 'test.beepboop', size: 12345)
preflight(name: 'test.beepboop', size: 12_345)
assert_status(200)
end
it "uploads to a student's Submissions folder" do
preflight(name: 'test.txt', size: 12345, content_type: 'text/plain')
preflight(name: 'test.txt', size: 12_345, content_type: 'text/plain')
f = Attachment.last.folder
expect(f.submission_context_code).to eq @course.asset_string
end

View File

@ -137,7 +137,7 @@ module MobileQuizQuestionData
"name" => "Question",
"correct_comments" => "",
"question_type" => "true_false_question",
"assessment_question_id" => 8197062,
"assessment_question_id" => 8_197_062,
"neutral_comments" => "",
"incorrect_comments" => "",
"question_name" => "Question",

View File

@ -1580,7 +1580,7 @@ describe AccountsController do
end
it "is able to search by course sis id" do
@c3 = course_factory(account: @account, course_name: "apple", sis_source_id: 30012)
@c3 = course_factory(account: @account, course_name: "apple", sis_source_id: 30_012)
@c4 = course_with_teacher(name: 'Teach Teacherson', course: course_factory(account: @account, course_name: "Apps", sis_source_id: 3002))

View File

@ -700,7 +700,7 @@ RSpec.describe ApplicationController do
let(:page_view_info) do
{
request_id: '379b0dbc-f01c-4dc4-ae05-15f23588cefb',
user_id: 10000000000004,
user_id: 10_000_000_000_004,
created_at: '2020-06-12T17:02:44.14Z'
}
end
@ -1731,7 +1731,7 @@ RSpec.describe ApplicationController do
end
it 'stringifies the non-strings in the context attributes' do
current_user_attributes = { global_id: 12345, time_zone: 'asdf' }
current_user_attributes = { global_id: 12_345, time_zone: 'asdf' }
current_user = double(current_user_attributes)
controller.instance_variable_set(:@current_user, current_user)

View File

@ -2646,7 +2646,7 @@ describe CoursesController do
end
it "rejects non-course ids" do
put 'update', params: { :id => @course.id, :course => { :image_id => 1234134123 } }
put 'update', params: { :id => @course.id, :course => { :image_id => 1_234_134_123 } }
@course.reload
expect(@course.settings[:image_id]).to be_nil
end

View File

@ -82,7 +82,7 @@ describe DisablePostToSisApiController do
it 'responds with 400 when grading period does not exist' do
put 'disable_post_to_sis', params: { course_id: course.id,
grading_period_id: 789465789 }
grading_period_id: 789_465_789 }
parsed_json = json_parse(response.body)
expect(response.code).to eq "400"

View File

@ -82,7 +82,7 @@ describe ExternalToolsController do
it "sets status code to 404 if the requested tool id does not exist" do
user_session(@teacher)
get :jwt_token, params: { course_id: @course.id, tool_id: 999999 }
get :jwt_token, params: { course_id: @course.id, tool_id: 999_999 }
expect(response.status).to eq 404
end

View File

@ -287,7 +287,7 @@ describe GroupCategoriesController do
it "fails if category doesn't exist" do
user_session(@teacher)
delete 'destroy', params: { :course_id => @course.id, :id => 11235 }
delete 'destroy', params: { :course_id => @course.id, :id => 11_235 }
expect(response).not_to be_successful
end

View File

@ -409,7 +409,7 @@ describe GroupsController do
it "fails when group[group_category_id] would be honored but doesn't exist" do
user_session(@student)
@course.group_categories.create(:name => 'some category')
post 'create', params: { :course_id => @course.id, :group => { :name => "some group", :group_category_id => 11235 } }
post 'create', params: { :course_id => @course.id, :group => { :name => "some group", :group_category_id => 11_235 } }
expect(response).not_to be_successful
end
@ -496,7 +496,7 @@ describe GroupsController do
user_session(@teacher)
group_category = @course.group_categories.create(:name => 'some category')
@group = @course.groups.create!(:name => "some group", :group_category => group_category)
put 'update', params: { :course_id => @course.id, :id => @group.id, :group => { :group_category_id => 11235 } }
put 'update', params: { :course_id => @course.id, :id => @group.id, :group => { :group_category_id => 11_235 } }
expect(response).not_to be_successful
end

View File

@ -78,7 +78,7 @@ describe Lti::AccountExternalToolsController do
context 'when an invalid account ID is given' do
let(:params_overrides) do
{ account_id: 991234 }
{ account_id: 991_234 }
end
it 'returns a 401' do

View File

@ -63,7 +63,7 @@ describe Lti::AccountLookupController do
context 'when an invalid account ID is given' do
let(:params_overrides) do
{ account_id: 991234 }
{ account_id: 991_234 }
end
it 'returns a 404' do
@ -74,11 +74,11 @@ describe Lti::AccountLookupController do
context 'when an ID on an invalid shard given' do
let(:params_overrides) do
{ account_id: 1987650000000000000 + Account.root_accounts.first.local_id }
{ account_id: 1_987_650_000_000_000_000 + Account.root_accounts.first.local_id }
end
it 'returns a 404' do
expect(Shard.find_by(id: 198765)).to eq(nil)
expect(Shard.find_by(id: 198_765)).to eq(nil)
send_request
expect(response.code).to eq('404')
end

View File

@ -78,7 +78,7 @@ describe Lti::IMS::NamesAndRolesController do
end
context 'when the page size parameter is too large' do
let(:rqst_page_size) { 4611686018427387903 }
let(:rqst_page_size) { 4_611_686_018_427_387_903 }
let(:effective_page_size) { 50 } # system max
let(:rsp_page_size) { total_items }

View File

@ -888,7 +888,7 @@ module Lti::IMS
# into 10 Oct 3022, which is not desired behavior. it's also further in
# the future than the current time, which returns a different exception
# and obscures this behavior
let(:timestamp) { 3022101316 }
let(:timestamp) { 3_022_101_316 }
let(:params_overrides) { super().merge(timestamp: timestamp) }
it_behaves_like 'a bad request'
@ -897,7 +897,7 @@ module Lti::IMS
context 'when submitted_at extension is a timestamp, but not an is08601 timestamp' do
# this is an epoch timestamp that correctly parses using Time.zone.parse
# into 10 Oct 1637, which is not desired behavior
let(:timestamp) { 1637101316 }
let(:timestamp) { 1_637_101_316 }
let(:params_overrides) do
super().merge(Lti::Result::AGS_EXT_SUBMISSION => { submitted_at: timestamp })
end

View File

@ -25,7 +25,7 @@ require 'csv'
describe PageViewsController do
# Factory-like thing for page views.
def page_view(user, url, options = {})
options.reverse_merge!(:request_id => 'req' + rand(100000000).to_s,
options.reverse_merge!(:request_id => 'req' + rand(100_000_000).to_s,
:user_agent => 'Firefox/12.0')
options[:url] = url

View File

@ -29,8 +29,8 @@ describe Quizzes::QuizQuestionsController do
def quiz_question
@question = @quiz.quiz_questions.build
@question.write_attribute(:question_data, { :answers => [
{ :id => 123456, :answer_text => 'asdf', :weight => 100 },
{ :id => 654321, :answer_text => 'jkl;', :weight => 0 }
{ :id => 123_456, :answer_text => 'asdf', :weight => 100 },
{ :id => 654_321, :answer_text => 'jkl;', :weight => 0 }
] })
@question.save!
@question
@ -78,17 +78,17 @@ describe Quizzes::QuizQuestionsController do
:question_type => "multiple_choice_question",
:answers => [
{
:id => 123456,
:id => 123_456,
:answer_text => 'asdf',
:weight => 100
},
{
:id => 654321,
:id => 654_321,
:answer_text => 'jkl;',
:weight => 0
},
{
:id => 654321,
:id => 654_321,
:answer_text => 'qwer',
:weight => 0
}
@ -99,9 +99,9 @@ describe Quizzes::QuizQuestionsController do
data = assigns[:question].question_data[:answers]
expect(data.length).to eql(3)
expect(data[0][:id]).to eql(123456)
expect(data[1][:id]).to eql(654321)
expect(data[2][:id]).not_to eql(654321)
expect(data[0][:id]).to eql(123_456)
expect(data[1][:id]).to eql(654_321)
expect(data[2][:id]).not_to eql(654_321)
end
it 'bounces data thats too long' do
@ -186,17 +186,17 @@ describe Quizzes::QuizQuestionsController do
:question_type => "multiple_choice_question",
:answers => {
'0' => {
:id => 123456,
:id => 123_456,
:answer_text => 'asdf',
:weight => 100
},
'1' => {
:id => 654321,
:id => 654_321,
:answer_text => 'jkl;',
:weight => 0
},
'2' => {
:id => 654321,
:id => 654_321,
:answer_text => 'qwer',
:weight => 0
}
@ -206,9 +206,9 @@ describe Quizzes::QuizQuestionsController do
expect(assigns[:question].question_data).not_to be_nil
data = assigns[:question].question_data[:answers]
expect(data.length).to eql(3)
expect(data[0][:id]).to eql(123456)
expect(data[1][:id]).to eql(654321)
expect(data[2][:id]).not_to eql(654321)
expect(data[0][:id]).to eql(123_456)
expect(data[1][:id]).to eql(654_321)
expect(data[2][:id]).not_to eql(654_321)
end
it 'bounces data thats too long' do

View File

@ -41,7 +41,7 @@ module Factories
# it tries to load it from the db.)
allow(pseudonym).to receive(:id).and_return(pseudonym.object_id)
allow(pseudonym).to receive(:unique_id).and_return('unique_id')
allow(pseudonym).to receive(:global_id).and_return(10000000000001)
allow(pseudonym).to receive(:global_id).and_return(10_000_000_000_001)
end
session = double('PseudonymSession',

View File

@ -152,7 +152,7 @@ module Factories
"name" => "Question",
"correct_comments" => "",
"question_type" => "true_false_question",
"assessment_question_id" => 8197062,
"assessment_question_id" => 8_197_062,
"neutral_comments" => "",
"incorrect_comments" => "",
"question_name" => "Question",
@ -181,7 +181,7 @@ module Factories
"name" => "Question",
"correct_comments" => "",
"question_type" => "short_answer_question",
"assessment_question_id" => 8197062,
"assessment_question_id" => 8_197_062,
"neutral_comments" => "",
"incorrect_comments" => "",
"question_name" => "Question",
@ -206,11 +206,11 @@ module Factories
end
def short_answer_question_data_one_blank
{ "name" => "Question", "correct_comments" => "", "question_type" => "short_answer_question", "assessment_question_id" => 8197062, "neutral_comments" => "", "incorrect_comments" => "", "question_name" => "Question", "points_possible" => 16.5, "answers" => [{ "comments" => "", "weight" => 100, "text" => "stupid", "id" => 7100 }, { "comments" => "", "weight" => 100, "text" => "dumb", "id" => 2159 }, { "comments" => "", "weight" => 100, "text" => "", "id" => 9090 }], "question_text" => "<p>there's no such thing as a _____ question</p>", "id" => 1 }.with_indifferent_access
{ "name" => "Question", "correct_comments" => "", "question_type" => "short_answer_question", "assessment_question_id" => 8_197_062, "neutral_comments" => "", "incorrect_comments" => "", "question_name" => "Question", "points_possible" => 16.5, "answers" => [{ "comments" => "", "weight" => 100, "text" => "stupid", "id" => 7100 }, { "comments" => "", "weight" => 100, "text" => "dumb", "id" => 2159 }, { "comments" => "", "weight" => 100, "text" => "", "id" => 9090 }], "question_text" => "<p>there's no such thing as a _____ question</p>", "id" => 1 }.with_indifferent_access
end
def essay_question_data
{ "name" => "Question", "correct_comments" => "", "question_type" => "essay_question", "comments" => nil, "assessment_question_id" => 8197062, "neutral_comments" => "", "incorrect_comments" => "", "question_name" => "Question", "points_possible" => 13.6, "answers" => [], "question_text" => "<p>Please summarize the history of the world in 3 sentences</p>", "id" => 1 }.with_indifferent_access
{ "name" => "Question", "correct_comments" => "", "question_type" => "essay_question", "comments" => nil, "assessment_question_id" => 8_197_062, "neutral_comments" => "", "incorrect_comments" => "", "question_name" => "Question", "points_possible" => 13.6, "answers" => [], "question_text" => "<p>Please summarize the history of the world in 3 sentences</p>", "id" => 1 }.with_indifferent_access
end
def text_only_question_data
@ -218,7 +218,7 @@ module Factories
end
def multiple_dropdowns_question_data
{ "position" => 3, "correct_comments" => "", "name" => "Question 3", "question_type" => "multiple_dropdowns_question", "assessment_question_id" => 1695442, "neutral_comments" => "", "incorrect_comments" => "", "id" => 1630873, "question_name" => "Question 3", "points_possible" => 0.5, "original_question_text" => "[structure1] [event1] [structure2] [structure3] [structure4] [structure5] [structure6] [event2] [structure7]", "answers" => [
{ "position" => 3, "correct_comments" => "", "name" => "Question 3", "question_type" => "multiple_dropdowns_question", "assessment_question_id" => 1_695_442, "neutral_comments" => "", "incorrect_comments" => "", "id" => 1_630_873, "question_name" => "Question 3", "points_possible" => 0.5, "original_question_text" => "[structure1] [event1] [structure2] [structure3] [structure4] [structure5] [structure6] [event2] [structure7]", "answers" => [
{ "comments" => "", "weight" => 100, "text" => "y", "id" => 4390, "blank_id" => "structure1" },
{ "comments" => "", "weight" => 0, "text" => "n", "id" => 1522, "blank_id" => "structure1" },
{ "comments" => "", "weight" => 0, "text" => "n", "id" => 7446, "blank_id" => "structure1" },
@ -287,7 +287,7 @@ module Factories
end
def numerical_question_data
{ "name" => "Question", "correct_comments" => "", "question_type" => "numerical_question", "assessment_question_id" => 8197062, "neutral_comments" => "", "incorrect_comments" => "", "question_name" => "Question", "points_possible" => 26.2, "answers" => [
{ "name" => "Question", "correct_comments" => "", "question_type" => "numerical_question", "assessment_question_id" => 8_197_062, "neutral_comments" => "", "incorrect_comments" => "", "question_name" => "Question", "points_possible" => 26.2, "answers" => [
{ "exact" => 4, "comments" => "", "numerical_answer_type" => "exact_answer", "margin" => 0, "weight" => 100, "text" => "", "id" => 9222 },
{ "exact" => -4, "comments" => "", "numerical_answer_type" => "exact_answer", "margin" => 0, "weight" => 100, "text" => "", "id" => 997 },
{ "comments" => "", "numerical_answer_type" => "range_answer", "weight" => 100, "text" => "", "id" => 9370, "end" => 4.1, "start" => 3.9 },
@ -300,7 +300,7 @@ module Factories
{ "name" => "Question",
"correct_comments" => "",
"question_type" => "numerical_question",
"assessment_question_id" => 8197062,
"assessment_question_id" => 8_197_062,
"neutral_comments" => "",
"incorrect_comments" => "",
"question_name" => "Question",
@ -318,7 +318,7 @@ module Factories
"answer_tolerance" => 0.02,
"question_type" => "calculated_question",
"formulas" => [{ "formula" => "5 + (x - y)" }],
"assessment_question_id" => 8197062,
"assessment_question_id" => 8_197_062,
"variables" =>
[{ "name" => "x", "scale" => 2, "max" => 7, "min" => 2 },
{ "name" => "y", "scale" => 0, "max" => 23, "min" => 17 }],
@ -345,7 +345,7 @@ module Factories
data = { "name" => "Question",
"correct_comments" => "",
"question_type" => "multiple_answers_question",
"assessment_question_id" => 8197062,
"assessment_question_id" => 8_197_062,
"neutral_comments" => "",
"incorrect_comments" => "",
"question_name" => "Question",

View File

@ -18,7 +18,7 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
FactoryBot.define do
sequence(:user_id) { |n| 10000 + n }
sequence(:user_id) { |n| 10_000 + n }
factory :rule, class: ConditionalRelease::Rule do
root_account_id { Account.default.id }

View File

@ -21,7 +21,7 @@
require 'nokogiri'
describe CanvasConnect::MeetingArchive do
subject { CanvasConnect::MeetingArchive.retrieve(38230, mock_client.new).first }
subject { CanvasConnect::MeetingArchive.retrieve(38_230, mock_client.new).first }
let(:mock_client) do
Class.new do
@ -49,7 +49,7 @@ describe CanvasConnect::MeetingArchive do
end
it "returns the correct number" do
expect(CanvasConnect::MeetingArchive.retrieve(38230, mock_client.new).count).to eq 2
expect(CanvasConnect::MeetingArchive.retrieve(38_230, mock_client.new).count).to eq 2
end
it "returns the name" do

View File

@ -56,7 +56,7 @@ describe Mutations::CreateGroupInSet do
end
it "fails gracefully for invalid group sets" do
invalid_group_set_id = 111111111111111111
invalid_group_set_id = 111_111_111_111_111_111
result = CanvasSchema.execute(mutation_str(group_set_id: invalid_group_set_id), context: { current_user: @student })
expect(result["errors"]).not_to be_nil
expect(result.dig(*%w[data createGroupInSet])).to be_nil

View File

@ -119,7 +119,7 @@ describe Mutations::CreateLearningOutcomeGroup do
end
it "requires parent outcome group to exist" do
result = execute_query(mutation_str(id: 99999, title: title), context)
result = execute_query(mutation_str(id: 99_999, title: title), context)
expect_error(result, 'Group not found')
end

View File

@ -102,7 +102,7 @@ describe Mutations::CreateSubmissionComment do
describe 'submission_id argument' do
it 'is gracefully handled when the submission is not found' do
result = run_mutation(submission_id: 12345)
result = run_mutation(submission_id: 12_345)
expect(result[:errors].length).to eq 1
expect(result[:errors][0][:message]).to eq 'not found'
end

View File

@ -295,7 +295,7 @@ RSpec.describe Mutations::CreateSubmission do
end
it 'returns a graceful error if the assignment is not found' do
result = run_mutation(assignment_id: 12345)
result = run_mutation(assignment_id: 12_345)
expect(result.dig(:errors, 0, :message)).to eq 'not found'
end

View File

@ -126,7 +126,7 @@ describe Mutations::DeleteOutcomeLinks do
end
it 'fails to delete outcome link if link id is invalid' do
result = execute_with_input(variables({ ids: [123456789] }))
result = execute_with_input(variables({ ids: [123_456_789] }))
data = result.dig('data', 'deleteOutcomeLinks', 'deletedOutcomeLinkIds')
expect_error(result, 'Could not find outcome link')
expect(data).to be_empty

View File

@ -161,7 +161,7 @@ describe Mutations::MoveOutcomeLinks do
end
it "validates group not exist" do
response = execute_query(mutation_str(group_id: 123123, outcome_link_ids: []), {})
response = execute_query(mutation_str(group_id: 123_123, outcome_link_ids: []), {})
expect(response["errors"][0]["message"]).to eql(
"Group not found"
)
@ -193,7 +193,7 @@ describe Mutations::MoveOutcomeLinks do
response = execute_query(
mutation_str(
group_id: @destination_group.id,
outcome_link_ids: [123123]
outcome_link_ids: [123_123]
),
{
current_user: @teacher

View File

@ -189,7 +189,7 @@ describe Mutations::UpdateLearningOutcomeGroup do
end
it "requires outcome group to exist" do
result = execute_query(mutation_str(id: 99999), context)
result = execute_query(mutation_str(id: 99_999), context)
expect_error(result, "Group not found")
end
@ -197,7 +197,7 @@ describe Mutations::UpdateLearningOutcomeGroup do
result = execute_query(
mutation_str(
id: @group.id,
parent_outcome_group_id: 99999
parent_outcome_group_id: 99_999
),
context
)

View File

@ -85,7 +85,7 @@ describe Mutations::UpdateLearningOutcome do
end
it "requires outcome to exist" do
result = execute_with_input(variables(id: 99999))
result = execute_with_input(variables(id: 99_999))
expect_error(result, "unable to find LearningOutcome")
end

View File

@ -359,7 +359,7 @@ RSpec.describe Mutations::UpdateNotificationPreferences do
it 'errors when given an account_id for an account that does not exist' do
result = run_mutation(
context_type: 'Account',
account_id: 987654321,
account_id: 987_654_321,
enabled: false
)
expect(result.dig(:errors, 0, :message)).to eq 'not found'
@ -368,7 +368,7 @@ RSpec.describe Mutations::UpdateNotificationPreferences do
it 'errors when given a course_id for a course that does not exist' do
result = run_mutation(
context_type: 'Course',
course_id: 987654321,
course_id: 987_654_321,
enabled: false
)
expect(result.dig(:errors, 0, :message)).to eq 'not found'

View File

@ -94,7 +94,7 @@ describe AssignmentsHelper do
})
@context = @assignment.context
account = @context.account
account.turnitin_account_id = 12345
account.turnitin_account_id = 12_345
account.turnitin_shared_secret = "the same combination on my luggage"
account.settings[:enable_turnitin] = true
account.save!

View File

@ -66,12 +66,12 @@ describe 'Delayed::Job' do
end
it "is resiliant to unexpected data" do
job = Delayed::Job.new(priority: 20, created_at: Time.zone.now, strand: "test", account_id: 12345)
job = Delayed::Job.new(priority: 20, created_at: Time.zone.now, strand: "test", account_id: 12_345)
log_hash = JSON.parse(job.to_log_format).with_indifferent_access
expect(log_hash["priority"]).to eq(20)
expect(log_hash["strand"]).to eq("test")
expect(log_hash["shard_id"]).to eq(Shard.current.id)
expect(log_hash["account_id"]).to eq(12345)
expect(log_hash["account_id"]).to eq(12_345)
expect(log_hash["root_account_id"]).to be_nil
expect(log_hash["jobs_cluster"]).to eq(Shard.current.delayed_jobs_shard.id)
expect(log_hash["db_cluster"]).to eq(Shard.current.database_server.id)

View File

@ -75,7 +75,7 @@ describe "page views" do
it "sets the canvas meta header on interaction_seconds update" do
course_with_teacher_logged_in(:active_all => 1)
page_view = PageView.new
page_view.request_id = rand(10000000).to_s
page_view.request_id = rand(10_000_000).to_s
page_view.user = @user
page_view.save

View File

@ -42,7 +42,7 @@ describe Api::V1::PageView do
:context_type => 'Course',
:context_id => @course.id,
:asset_type => 'asset',
:asset_id => 12345,
:asset_id => 12_345,
:user_agent => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_5) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1',
:render_time => 0.369,
:participated => false,

View File

@ -55,7 +55,7 @@ describe AuthenticationMethods::InstAccessToken do
end
it "chooses the local user when a local and shadow user share the same UUID" do
user_model(id: (10_000_000_000_000 + (rand * 10000000).to_i), uuid: 'a-shared-uuid-between-users')
user_model(id: (10_000_000_000_000 + (rand * 10_000_000).to_i), uuid: 'a-shared-uuid-between-users')
account = Account.default
user_with_pseudonym(:active_all => true)
@user.uuid = 'a-shared-uuid-between-users'

View File

@ -54,7 +54,7 @@ describe Canvas::Apm::InstJobs::Plugin do
it 'has resource name equal to job name' do
expect(Canvas::Apm::InstJobs::Plugin.tracer).to eq(tracer)
job = Delayed::Job.enqueue(sample_job_object.new, {})
job.account_id = 12345
job.account_id = 12_345
Delayed::Testing.run_job(job)
expect(span.resource).to eq('SampleJob')
expect(span.tags["inst_jobs.id"] > 0).to be_truthy

View File

@ -130,8 +130,8 @@ describe Canvas::Apm do
Canvas::Apm.hostname = "testbox"
Canvas::Apm.tracer.trace("TESTING") do |span|
shard = OpenStruct.new({ id: 42 })
account = OpenStruct.new({ global_id: 420000042 })
user = OpenStruct.new({ global_id: 42100000421 })
account = OpenStruct.new({ global_id: 420_000_042 })
user = OpenStruct.new({ global_id: 42_100_000_421 })
generate_request_id = "1234567890"
expect(tracer.active_root_span).to eq(span)
Canvas::Apm.annotate_trace(shard, account, generate_request_id, user)

View File

@ -29,8 +29,8 @@ module Canvas
let(:request_context_id) { 'abcdefg1234567' }
let(:auth_header) { "OAuth oauth_body_hash=\"2jmj7l5rSw0yVb%2FvlWAYkK%2FYBwk%3D\", oauth_consumer_key=\"test_key\", oauth_nonce=\"QFOhAwKHz0UATQSdycHdNkMZYpkhkzU1lYpwvIF3Q8\", oauth_signature=\"QUfER7WBKsq0nzIjJ8Y7iTcDaq0%3D\", oauth_signature_method=\"HMAC-SHA1\", oauth_timestamp=\"1445980405\", oauth_version=\"1.0\"" }
let(:account) { double(global_id: 1122334455) }
let(:user) { double(global_id: 5544332211) }
let(:account) { double(global_id: 1_122_334_455) }
let(:user) { double(global_id: 5_544_332_211) }
let(:opts) { { request_context_id: request_context_id, type: 'core_meltdown' } }
describe 'initialization' do
@ -49,7 +49,7 @@ module Canvas
it 'digests request information' do
allow(request).to receive(:remote_ip).and_return("123.456")
expect(output[:tags][:account_id]).to eq(1122334455)
expect(output[:tags][:account_id]).to eq(1_122_334_455)
expect(output[:tags][:type]).to eq('core_meltdown')
expect(output[:extra][:request_context_id]).to eq(request_context_id)
expect(output[:extra]['REMOTE_ADDR']).to eq("123.456")
@ -66,7 +66,7 @@ module Canvas
end
it 'includes user information' do
expect(output[:tags][:user_id]).to eq(5544332211)
expect(output[:tags][:user_id]).to eq(5_544_332_211)
end
it 'passes important headers' do

View File

@ -689,7 +689,7 @@ describe "ZipPackage" do
zip_package = create_zip_package
course_data = zip_package.parse_course_data
expect(course_data[:assignments]).to eq []
expect(course_data[:files]).to eq [{ type: "file", name: "cn_image.jpg", size: 30339, files: nil }]
expect(course_data[:files]).to eq [{ type: "file", name: "cn_image.jpg", size: 30_339, files: nil }]
end
it "exports items that are module items" do
@ -818,15 +818,15 @@ describe "ZipPackage" do
course_data = create_zip_package.parse_course_data
expect(course_data[:pages].length).to eq 1
expect(course_data[:files]).to include(
{ type: 'file', name: '292.mp3', size: 123716, files: nil },
{ type: 'file', name: 'cn_image.jpg', size: 30339, files: nil },
{ type: 'file', name: '292.mp3', size: 123_716, files: nil },
{ type: 'file', name: 'cn_image.jpg', size: 30_339, files: nil },
{ type: 'file', name: 'amazing_file.txt', size: 26, files: nil }
)
end
it 'does not blow up when exporting linked recorded media files' do
media_id = "m_media-id"
file_data = { type: 'file', name: 'video.mp4', size: 172780, files: nil }
file_data = { type: 'file', name: 'video.mp4', size: 172_780, files: nil }
att = Attachment.create!(
filename: 'video.mp4',
uploaded_data: StringIO.new('recorded stuff'),
@ -854,7 +854,7 @@ describe "ZipPackage" do
it "doesn't blow up when a media upload is in another folder" do
media_id = "m_media-id"
file_data = { type: 'file', name: 'video.mp4', size: 172780, files: nil }
file_data = { type: 'file', name: 'video.mp4', size: 172_780, files: nil }
att = Attachment.create!(
filename: 'video.mp4',
uploaded_data: StringIO.new('recorded stuff'),
@ -909,7 +909,7 @@ describe "ZipPackage" do
assignmentExportId: create_key(survey.assignment), questionCount: 0, timeLimit: nil,
attempts: 1, graded: false, dueAt: due_at.iso8601, lockAt: nil, unlockAt: nil
}]
expect(course_data[:files]).to eq [{ type: "file", name: "cn_image.jpg", size: 30339, files: nil }]
expect(course_data[:files]).to eq [{ type: "file", name: "cn_image.jpg", size: 30_339, files: nil }]
end
it "exports quizzes and discussions that are linked as assignments" do
@ -952,7 +952,7 @@ describe "ZipPackage" do
lockAt: nil, unlockAt: nil, graded: false
}]
expect(course_data[:files]).to eq [{ type: "folder", name: "folder#1", size: nil, files:
[{ type: "file", name: "cn_image.jpg", size: 30339, files: nil }] }]
[{ type: "file", name: "cn_image.jpg", size: 30_339, files: nil }] }]
end
it "does not crash on index links" do
@ -977,7 +977,7 @@ describe "ZipPackage" do
module2.unlock_at = 1.day.from_now
module2.save!
course_data = create_zip_package.parse_course_data
expect(course_data[:files]).to eq [{ type: "file", name: "cn_image.jpg", size: 30339, files: nil }]
expect(course_data[:files]).to eq [{ type: "file", name: "cn_image.jpg", size: 30_339, files: nil }]
expect(course_data[:pages]).to eq []
end
end

View File

@ -1081,13 +1081,13 @@ describe "Canvas Cartridge importing" do
"migration_id" => "i0c012cbae54b972138520466e557f5e4",
"quiz_migration_id" => "ie3d8f8adfad423eb225229c539cdc450",
"points_possible" => 0,
"all_day_date" => 1305698400000,
"all_day_date" => 1_305_698_400_000,
"submission_types" => "online_quiz",
"peer_review_count" => 0,
"assignment_group_migration_id" => "i713e960ab2685259505efeb08cd48a1d",
"automatic_peer_reviews" => false,
"grading_type" => "points",
"due_at" => 1305805680000,
"due_at" => 1_305_805_680_000,
"peer_reviews" => false,
"all_day" => false },
"migration_id" => "ie3d8f8adfad423eb225229c539cdc450",
@ -1102,7 +1102,7 @@ describe "Canvas Cartridge importing" do
"assignment_group_migration_id" => "i713e960ab2685259505efeb08cd48a1d",
"time_limit" => nil,
"allowed_attempts" => -1,
"due_at" => 1305805680000,
"due_at" => 1_305_805_680_000,
"could_be_locked" => true,
"anonymous_submissions" => false,
"show_correct_answers" => true }
@ -1146,7 +1146,7 @@ describe "Canvas Cartridge importing" do
"description" => "",
"time_limit" => nil,
"allowed_attempts" => -1,
"due_at" => 1305805680000,
"due_at" => 1_305_805_680_000,
"could_be_locked" => true,
"anonymous_submissions" => false,
"show_correct_answers" => true
@ -1159,11 +1159,11 @@ describe "Canvas Cartridge importing" do
"grading_standard_migration_id" => nil,
"migration_id" => "assignmentmigrationid",
"points_possible" => 0,
"all_day_date" => 1305698400000,
"all_day_date" => 1_305_698_400_000,
"peer_review_count" => 0,
"automatic_peer_reviews" => false,
"grading_type" => "points",
"due_at" => 1305805680000,
"due_at" => 1_305_805_680_000,
"peer_reviews" => false,
"all_day" => false
}.with_indifferent_access
@ -1305,11 +1305,11 @@ describe "Canvas Cartridge importing" do
"grading_standard_migration_id" => nil,
"migration_id" => "assignmentmigrationid",
"points_possible" => 0,
"all_day_date" => 1305698400000,
"all_day_date" => 1_305_698_400_000,
"peer_review_count" => 0,
"automatic_peer_reviews" => false,
"grading_type" => "points",
"due_at" => 1305805680000,
"due_at" => 1_305_805_680_000,
"peer_reviews" => false,
"all_day" => false,
"description" => "<a href='wiki_page_migration_id=notarealid'>hooray for bad links</a>"
@ -1335,16 +1335,16 @@ describe "Canvas Cartridge importing" do
"calendar_events" => [{
"migration_id" => "id4bebe19c7b729e22543bed8a5a02dcb",
"title" => "Start of Course",
"start_at" => 1371189600000,
"end_at" => 1371189600000,
"start_at" => 1_371_189_600_000,
"end_at" => 1_371_189_600_000,
"all_day" => false,
"description" => "<a href='discussion_topic_migration_id=stillnotreal'>hooray for bad links</a>"
},
{
"migration_id" => "blahblahblah",
"title" => "Start of Course",
"start_at" => 1371189600000,
"end_at" => 1371189600000,
"start_at" => 1_371_189_600_000,
"end_at" => 1_371_189_600_000,
"all_day" => false,
"description" => "<a href='http://thislinkshouldbeokaythough.com'>hooray for good links</a>"
}]
@ -1388,8 +1388,8 @@ describe "Canvas Cartridge importing" do
"title" => "Two-Question Class Evaluation...",
"migration_id" => "iaccaf448c9f5218ff2a89d1d846b5224",
"type" => "announcement",
"posted_at" => 1332158400000,
"delayed_post_at" => 1361793600000,
"posted_at" => 1_332_158_400_000,
"delayed_post_at" => 1_361_793_600_000,
"position" => 41
},
{
@ -1397,8 +1397,8 @@ describe "Canvas Cartridge importing" do
"title" => "Two-Question Class Evaluation...",
"migration_id" => "iaccaf448c9f5218ff2a89d1d846b52242",
"type" => "discussion",
"posted_at" => 1332158400000,
"delayed_post_at" => 1361793600000,
"posted_at" => 1_332_158_400_000,
"delayed_post_at" => 1_361_793_600_000,
"position" => 41
}]
}.with_indifferent_access
@ -1439,9 +1439,9 @@ describe "Canvas Cartridge importing" do
"scoring_policy" => "keep_highest",
"assignment_group_migration_id" => "ia517adfdd9051a85ec5cfb1c57b9b853",
"points_possible" => 1,
"lock_at" => 1360825140000,
"unlock_at" => 1359615600000,
"due_at" => 1360220340000,
"lock_at" => 1_360_825_140_000,
"unlock_at" => 1_359_615_600_000,
"due_at" => 1_360_220_340_000,
"anonymous_submissions" => false,
"show_correct_answers" => false,
"require_lockdown_browser" => false,
@ -1490,9 +1490,9 @@ describe "Canvas Cartridge importing" do
"scoring_policy" => "keep_highest",
"assignment_group_migration_id" => "ia517adfdd9051a85ec5cfb1c57b9b853",
"points_possible" => 1,
"lock_at" => 1360825140000,
"unlock_at" => 1359615600000,
"due_at" => 1360220340000,
"lock_at" => 1_360_825_140_000,
"unlock_at" => 1_359_615_600_000,
"due_at" => 1_360_220_340_000,
"anonymous_submissions" => false,
"show_correct_answers" => false,
"require_lockdown_browser" => false,

View File

@ -58,18 +58,18 @@ describe DataFixup::InitNewGradeHistoryAuditLogIndexes do
[
'08d87bfc-a679-4f5d-9315-470a5fc7d7d0',
2.months.ago,
10000000000018,
10000000000116,
10000000000001,
10000000000006,
10_000_000_000_018,
10_000_000_000_116,
10_000_000_000_001,
10_000_000_000_006,
1.year
],
[
'fc85afda-538e-4fcb-a7fb-45697c551b71',
1.month.ago,
10000000000028,
10000000000144,
10000000000003,
10_000_000_000_028,
10_000_000_000_144,
10_000_000_000_003,
1.year
]
]

View File

@ -1089,7 +1089,7 @@ describe DataFixup::PopulateRootAccountIdOnModels do
# Cross-shard -- to be ignored (can't tell if it exists or not easily)
f3 = Folder.create!(context: @course)
f3.update_columns(context_id: ((Shard.last&.id.to_i + 99999) * Shard::IDS_PER_SHARD) + 1)
f3.update_columns(context_id: ((Shard.last&.id.to_i + 99_999) * Shard::IDS_PER_SHARD) + 1)
# Course exists. Not returned.
f4 = Folder.create!(context: @course)

View File

@ -269,7 +269,7 @@ describe GradeCalculator do
it "grade dropping should work even in ridiculous circumstances" do
set_grades [[nil, 20], [3, 10], [nil, 10],
[nil, 999999999],
[nil, 999_999_999],
[nil, nil]]
@group.update_attribute(:rules, 'drop_lowest:2')

View File

@ -662,10 +662,10 @@ module Lti
end
it 'has substitution for $Canvas.account.id' do
allow(account).to receive(:id).and_return(12345)
allow(account).to receive(:id).and_return(12_345)
exp_hash = { test: '$Canvas.account.id' }
variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq 12345
expect(exp_hash[:test]).to eq 12_345
end
it 'has substitution for $Canvas.account.name' do
@ -683,10 +683,10 @@ module Lti
end
it 'has substitution for $Canvas.rootAccount.id' do
allow(root_account).to receive(:id).and_return(54321)
allow(root_account).to receive(:id).and_return(54_321)
exp_hash = { test: '$Canvas.rootAccount.id' }
variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq 54321
expect(exp_hash[:test]).to eq 54_321
end
it 'has substitution for $Canvas.rootAccount.sisSourceId' do
@ -697,10 +697,10 @@ module Lti
end
it 'has substitution for $Canvas.root_account.id' do
allow(root_account).to receive(:id).and_return(54321)
allow(root_account).to receive(:id).and_return(54_321)
exp_hash = { test: '$Canvas.root_account.id' }
variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq 54321
expect(exp_hash[:test]).to eq 54_321
end
it 'has substitution for $Canvas.root_account.uuid' do
@ -718,10 +718,10 @@ module Lti
end
it 'has substitution for $Canvas.root_account.global_id' do
allow(root_account).to receive(:global_id).and_return(10054321)
allow(root_account).to receive(:global_id).and_return(10_054_321)
exp_hash = { test: '$Canvas.root_account.global_id' }
variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq 10054321
expect(exp_hash[:test]).to eq 10_054_321
end
it 'has substitution for $Canvas.shard.id' do

View File

@ -113,7 +113,7 @@ describe MicrosoftSync::LoginService do
"error" => "invalid_request",
"error_description" =>
"AADSTS90002: Tenant 'a.b.c' not found. This may happen if there are no active subscriptions for the tenant. Check to make sure you have the correct tenant ID. Check with your subscription administrator.\r\nTrace ID: etc.",
"error_codes" => [90002],
"error_codes" => [90_002],
"timestamp" => "2021-04-28 23:20:12Z",
"error_uri" => "https://login.microsoftonline.com/error?code=90002"
}
@ -129,7 +129,7 @@ describe MicrosoftSync::LoginService do
context '(400 status code, Tenant not valid domain)' do
let(:response_status) { 400 }
let(:response_body) do
{ "error_description" => "AADSTS900023: Specified tenant identifier '---' is neither a valid DNS name, nor a valid external domain.\r\nTrace ID: etc", "error_codes" => [900023], "timestamp" => "2021-04-28 23:20:23Z", "error_uri" => "https://login.microsoftonline.com/error?code=900023" }
{ "error_description" => "AADSTS900023: Specified tenant identifier '---' is neither a valid DNS name, nor a valid external domain.\r\nTrace ID: etc", "error_codes" => [900_023], "timestamp" => "2021-04-28 23:20:23Z", "error_uri" => "https://login.microsoftonline.com/error?code=900023" }
end
it 'raises a TenantDoesNotExist (graceful cancel error)' do

View File

@ -186,7 +186,7 @@ module MicrosoftSync
# On Jenkins, global and local IDs seems to be the same, so test this explicitly:
it 'uses the global id in the strand name' do
expect(state_record).to receive(:global_id).and_return 987650000000012345
expect(state_record).to receive(:global_id).and_return 987_650_000_000_012_345
subject.run_later
expect(steps_object.steps_run[0][1][0][:strand]).to eq(
"MicrosoftSync::StateMachineJobTest:MicrosoftSync::Group:987650000000012345"

Some files were not shown because too many files have changed in this diff Show More