)
res = Sanitize.clean(str, CanvasSanitize::SANITIZE)
expect(res).to eq "
but not me
"
end
it "is not extremely slow with long, weird microsoft styles" do
- str = %{}
+ str = %()
# the above string took over a minute to sanitize as of 8ae4ba8e
Timeout.timeout(1) { Sanitize.clean(str, CanvasSanitize::SANITIZE) }
end
diff --git a/gems/canvas_security/canvas_security.gemspec b/gems/canvas_security/canvas_security.gemspec
index f93aca5351b..9996a4944eb 100644
--- a/gems/canvas_security/canvas_security.gemspec
+++ b/gems/canvas_security/canvas_security.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["evizitei@instructure.com"]
spec.summary = 'Instructure gem for checking sigs and such'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/canvas_security/lib/canvas_security/key_storage.rb b/gems/canvas_security/lib/canvas_security/key_storage.rb
index e5c14d2bb38..277de3f34f1 100644
--- a/gems/canvas_security/lib/canvas_security/key_storage.rb
+++ b/gems/canvas_security/lib/canvas_security/key_storage.rb
@@ -80,7 +80,7 @@ module CanvasSecurity
def public_keyset
JSON::JWK::Set.new(retrieve_keys.values.compact.map do |private_jwk|
public_jwk = private_jwk.to_key.public_key.to_jwk
- public_jwk.merge(private_jwk.select { |k, _| %w(alg use kid).include?(k) })
+ public_jwk.merge(private_jwk.select { |k, _| %w[alg use kid].include?(k) })
end)
end
diff --git a/gems/canvas_security/spec/canvas_security/key_storage_spec.rb b/gems/canvas_security/spec/canvas_security/key_storage_spec.rb
index 6e2cbdf8a42..7b644e4c423 100644
--- a/gems/canvas_security/spec/canvas_security/key_storage_spec.rb
+++ b/gems/canvas_security/spec/canvas_security/key_storage_spec.rb
@@ -114,6 +114,6 @@ describe CanvasSecurity::KeyStorage do
end
def select_public_claims(key)
- key.select { |k, _| %w(kty e n kid alg use).include?(k) }
+ key.select { |k, _| %w[kty e n kid alg use].include?(k) }
end
end
diff --git a/gems/canvas_slug/canvas_slug.gemspec b/gems/canvas_slug/canvas_slug.gemspec
index be975c46f0f..e821ce3a7a7 100644
--- a/gems/canvas_slug/canvas_slug.gemspec
+++ b/gems/canvas_slug/canvas_slug.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com"]
spec.summary = 'Canvas Slug generation'
- spec.files = Dir.glob("{lib,test}/**/*") + %w(Rakefile)
+ spec.files = Dir.glob("{lib,test}/**/*") + %w[Rakefile]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/canvas_sort/canvas_sort.gemspec b/gems/canvas_sort/canvas_sort.gemspec
index 19920f8eb11..b8327656757 100644
--- a/gems/canvas_sort/canvas_sort.gemspec
+++ b/gems/canvas_sort/canvas_sort.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["ncloward@instructure.com"]
spec.summary = 'Canvas Sort'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/canvas_stringex/canvas_stringex.gemspec b/gems/canvas_stringex/canvas_stringex.gemspec
index bda58bb9acc..55afd62e5a8 100644
--- a/gems/canvas_stringex/canvas_stringex.gemspec
+++ b/gems/canvas_stringex/canvas_stringex.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com", "stephan@pivotallabs.com"]
spec.summary = 'Instructure fork of the stringex gem'
- spec.files = Dir.glob("{lib,test}/**/*") + %w(LICENSE.txt Rakefile README.rdoc test.sh)
+ spec.files = Dir.glob("{lib,test}/**/*") + %w[LICENSE.txt Rakefile README.rdoc test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/canvas_stringex/lib/lucky_sneaks/string_extensions.rb b/gems/canvas_stringex/lib/lucky_sneaks/string_extensions.rb
index a0ab1889d80..c7d40cef041 100644
--- a/gems/canvas_stringex/lib/lucky_sneaks/string_extensions.rb
+++ b/gems/canvas_stringex/lib/lucky_sneaks/string_extensions.rb
@@ -188,11 +188,11 @@ module LuckySneaks
# Returns string of random characters with a length matching the specified limit. Excludes 0
# to avoid confusion between 0 and O.
def random(limit)
- strong_alphanumerics = %w{
+ strong_alphanumerics = %w[
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
1 2 3 4 5 6 7 8 9
- }
+ ]
Array.new(limit, "").collect { strong_alphanumerics[rand(61)] }.join
end
end
diff --git a/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/basic_latin_spec.rb b/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/basic_latin_spec.rb
index dc30e1677b4..26be20eb8d0 100644
--- a/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/basic_latin_spec.rb
+++ b/gems/canvas_stringex/spec/lucky_sneaks/unicode_point_suite/basic_latin_spec.rb
@@ -33,56 +33,56 @@ describe "BasicLatin" do
# Get weird results trying to pack them to unicode.
it "spaces" do
- assert_equal_encoded " ", %w{0020 00a0}
- assert_equal_encoded "", %w{200b 2060}
+ assert_equal_encoded " ", %w[0020 00a0]
+ assert_equal_encoded "", %w[200b 2060]
end
it "exclamation_marks" do
- assert_equal_encoded "!", %w{0021 2762}
+ assert_equal_encoded "!", %w[0021 2762]
assert_equal_encoded "!!", "203c"
assert_equal_encoded "", "00a1"
assert_equal_encoded "?!", "203d"
end
it "quotation_marks" do
- assert_equal_encoded "\"", %w{0022 02ba 2033 3003}
+ assert_equal_encoded "\"", %w[0022 02ba 2033 3003]
end
it "apostrophes" do
- assert_equal_encoded "'", %w{0027 02b9 02bc 02c8 2032}
+ assert_equal_encoded "'", %w[0027 02b9 02bc 02c8 2032]
end
it "asterisks" do
- assert_equal_encoded "*", %w{002a 066d 204e 2217 26b9 2731}
+ assert_equal_encoded "*", %w[002a 066d 204e 2217 26b9 2731]
end
it "commas" do
- assert_equal_encoded ",", %w{002c 060c}
+ assert_equal_encoded ",", %w[002c 060c]
end
it "periods" do
- assert_equal_encoded ".", %w{002e 06d4}
+ assert_equal_encoded ".", %w[002e 06d4]
end
it "hyphens" do
- assert_equal_encoded "-", %w{002d 2010 2011 2012 2013 2212}
+ assert_equal_encoded "-", %w[002d 2010 2011 2012 2013 2212]
end
it "slashes" do
- assert_equal_encoded "/", %w{002f 2044 2215}
- assert_equal_encoded "\\", %w{005c 2216}
+ assert_equal_encoded "/", %w[002f 2044 2215]
+ assert_equal_encoded "\\", %w[005c 2216]
end
it "colons" do
- assert_equal_encoded ":", %w{003a 2236}
+ assert_equal_encoded ":", %w[003a 2236]
end
it "semicolons" do
- assert_equal_encoded ";", %w{003b 061b}
+ assert_equal_encoded ";", %w[003b 061b]
end
it "less_thans" do
- assert_equal_encoded "<", %w{003c 2039 2329 27e8 3008}
+ assert_equal_encoded "<", %w[003c 2039 2329 27e8 3008]
end
it "equals" do
@@ -90,52 +90,52 @@ describe "BasicLatin" do
end
it "greater_thans" do
- assert_equal_encoded ">", %w{003e 203a 232a 27e9 3009}
+ assert_equal_encoded ">", %w[003e 203a 232a 27e9 3009]
end
it "question_marks" do
- assert_equal_encoded "?", %w{003f 061f}
+ assert_equal_encoded "?", %w[003f 061f]
assert_equal_encoded "", "00bf"
- assert_equal_encoded "?!", %w{203d 2048}
+ assert_equal_encoded "?!", %w[203d 2048]
assert_equal_encoded "!?", "2049"
end
it "circumflexes" do
- assert_equal_encoded "^", %w{005e 2038 2303}
+ assert_equal_encoded "^", %w[005e 2038 2303]
end
it "underscores" do
- assert_equal_encoded "_", %w{005f 02cd 2017}
+ assert_equal_encoded "_", %w[005f 02cd 2017]
end
it "grave_accents" do
- assert_equal_encoded "`", %w{0060 02cb 2035}
+ assert_equal_encoded "`", %w[0060 02cb 2035]
end
it "bars" do
- assert_equal_encoded "|", %w{007c 2223 2758}
+ assert_equal_encoded "|", %w[007c 2223 2758]
end
it "tildes" do
- assert_equal_encoded "~", %w{007e 02dc 2053 223c ff5e}
+ assert_equal_encoded "~", %w[007e 02dc 2053 223c ff5e]
end
it "related_letters" do
{
"B" => "212c",
- "C" => %w{2102 212d},
- "E" => %w{2107 2130},
+ "C" => %w[2102 212d],
+ "E" => %w[2107 2130],
"F" => "2131",
- "H" => %w{210b 210c 210d},
- "I" => %w{0130 0406 04c0 2110 2111 2160},
+ "H" => %w[210b 210c 210d],
+ "I" => %w[0130 0406 04c0 2110 2111 2160],
"K" => "212a",
"L" => "2112",
"M" => "2133",
"N" => "2115",
"P" => "2119",
"Q" => "211a",
- "R" => %w{211b 211c 211d},
- "Z" => %w{2124 2128}
+ "R" => %w[211b 211c 211d],
+ "Z" => %w[2124 2128]
}.each do |expected, encode_mes|
assert_equal_encoded expected, encode_mes
end
diff --git a/gems/canvas_text_helper/canvas_text_helper.gemspec b/gems/canvas_text_helper/canvas_text_helper.gemspec
index faf99a8bfd1..3739bf306bc 100644
--- a/gems/canvas_text_helper/canvas_text_helper.gemspec
+++ b/gems/canvas_text_helper/canvas_text_helper.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["kromney@instructure.com", "nathanm@instructure.com"]
spec.summary = 'Canvas text helpers'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(Rakefile test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/canvas_time/canvas_time.gemspec b/gems/canvas_time/canvas_time.gemspec
index a6abf44a578..da7ddd3746a 100644
--- a/gems/canvas_time/canvas_time.gemspec
+++ b/gems/canvas_time/canvas_time.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com"]
spec.summary = 'Canvas Time'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/canvas_time/spec/canvas_time_spec.rb b/gems/canvas_time/spec/canvas_time_spec.rb
index 7ad8766b38f..e03f1f4ea36 100644
--- a/gems/canvas_time/spec/canvas_time_spec.rb
+++ b/gems/canvas_time/spec/canvas_time_spec.rb
@@ -34,7 +34,7 @@ describe 'Time Marshal override' do
dumped = Marshal.dump(raw_time)
# the last character differs between ruby 1.9 and ruby 2.1
expect(dumped[0..-2]).to eq("\x04\bIu:\tTime!pre1900:0010-05-13T04:12:51Z\x06:\x06E")
- expect(%w{F T}).to be_include(dumped[-1])
+ expect(%w[F T]).to be_include(dumped[-1])
dumped[-1] = 'F'
reloaded = Marshal.load(dumped)
expect(reloaded).to eq(raw_time)
diff --git a/gems/canvas_unzip/canvas_unzip.gemspec b/gems/canvas_unzip/canvas_unzip.gemspec
index 31f9e3a8f38..213bd7b22bd 100644
--- a/gems/canvas_unzip/canvas_unzip.gemspec
+++ b/gems/canvas_unzip/canvas_unzip.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["jeremy@instructure.com"]
spec.summary = 'Safe archive extraction'
- spec.files = Dir.glob("{lib,test}/**/*") + %w(Rakefile)
+ spec.files = Dir.glob("{lib,test}/**/*") + %w[Rakefile]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/config_file/config_file.gemspec b/gems/config_file/config_file.gemspec
index 61db7e772e8..ae42010a7a4 100644
--- a/gems/config_file/config_file.gemspec
+++ b/gems/config_file/config_file.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["evizitei@instructure.com"]
spec.summary = 'Instructure gem for loading config info from yaml on disk'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/csv_diff/csv_diff.gemspec b/gems/csv_diff/csv_diff.gemspec
index ac8335e6090..eb216cd9b2d 100644
--- a/gems/csv_diff/csv_diff.gemspec
+++ b/gems/csv_diff/csv_diff.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.email = ["brianp@instructure.com"]
spec.summary = 'Generate CSV diffs'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/diigo/diigo.gemspec b/gems/diigo/diigo.gemspec
index 13db4932813..c97d61c3a06 100644
--- a/gems/diigo/diigo.gemspec
+++ b/gems/diigo/diigo.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["brian@instructure.com"]
spec.summary = 'Diigo'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/dr_diff/lib/dr_diff/manager.rb b/gems/dr_diff/lib/dr_diff/manager.rb
index 14c6d29403d..154ec7e37dc 100644
--- a/gems/dr_diff/lib/dr_diff/manager.rb
+++ b/gems/dr_diff/lib/dr_diff/manager.rb
@@ -31,7 +31,7 @@ module DrDiff
private :severe_anywhere
# all levels: %w(error warn info)
- SEVERE_LEVELS = %w(error warn).freeze
+ SEVERE_LEVELS = %w[error warn].freeze
def initialize(git: nil, git_dir: nil, sha: nil, campsite: true, heavy: false, base_dir: nil, severe_anywhere: true)
@git_dir = git_dir
diff --git a/gems/dr_diff/spec/manager_spec.rb b/gems/dr_diff/spec/manager_spec.rb
index 1711132c811..eeeb5ba9be9 100644
--- a/gems/dr_diff/spec/manager_spec.rb
+++ b/gems/dr_diff/spec/manager_spec.rb
@@ -23,8 +23,8 @@ module DrDiff
describe Manager do
describe ".files" do
let(:git_files_output) do
- %{lib/dr_diff.rb
-spec/dr_diff_spec.rb}
+ %(lib/dr_diff.rb
+spec/dr_diff_spec.rb)
end
let(:file_list) { git_files_output.split("\n") }
diff --git a/gems/dynamic_settings/dynamic_settings.gemspec b/gems/dynamic_settings/dynamic_settings.gemspec
index dcfc2c09164..fe3ba869fcc 100644
--- a/gems/dynamic_settings/dynamic_settings.gemspec
+++ b/gems/dynamic_settings/dynamic_settings.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["jburroughs@instructure.com", "evizitei@instructure.com"]
spec.summary = 'Instructure gem for loading config and settings from consul'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/dynamic_settings/lib/dynamic_settings.rb b/gems/dynamic_settings/lib/dynamic_settings.rb
index 8aee2cb71e9..d8f81e5140a 100644
--- a/gems/dynamic_settings/lib/dynamic_settings.rb
+++ b/gems/dynamic_settings/lib/dynamic_settings.rb
@@ -28,7 +28,7 @@ require 'dynamic_settings/fallback_proxy'
require 'dynamic_settings/prefix_proxy'
module DynamicSettings
- CONSUL_READ_OPTIONS = %i{recurse stale}.freeze
+ CONSUL_READ_OPTIONS = %i[recurse stale].freeze
KV_NAMESPACE = "config/canvas"
CACHE_KEY_PREFIX = "dynamic_settings/"
diff --git a/gems/event_stream/event_stream.gemspec b/gems/event_stream/event_stream.gemspec
index e43803dd919..001b54dc339 100644
--- a/gems/event_stream/event_stream.gemspec
+++ b/gems/event_stream/event_stream.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["evizitei@instructure.com"]
spec.summary = 'Instructure event stream gem'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/google_drive/google_drive.gemspec b/gems/google_drive/google_drive.gemspec
index 7b052ddfa9b..a9c0fae14e0 100644
--- a/gems/google_drive/google_drive.gemspec
+++ b/gems/google_drive/google_drive.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["brad@instructure.com"]
spec.summary = 'Google Drive'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/google_drive/lib/google_drive/client.rb b/gems/google_drive/lib/google_drive/client.rb
index 3f6d6e5d3d2..3222c2a3b8e 100644
--- a/gems/google_drive/lib/google_drive/client.rb
+++ b/gems/google_drive/lib/google_drive/client.rb
@@ -39,7 +39,7 @@ module GoogleDrive
client.authorization.redirect_uri = client_secrets['redirect_uri']
client.authorization.refresh_token = refresh_token if refresh_token
client.authorization.access_token = access_token if access_token
- client.authorization.scope = %w{https://www.googleapis.com/auth/drive}
+ client.authorization.scope = %w[https://www.googleapis.com/auth/drive]
client
end
diff --git a/gems/google_drive/lib/google_drive/entry.rb b/gems/google_drive/lib/google_drive/entry.rb
index cc039375ad0..1f3489e9586 100644
--- a/gems/google_drive/lib/google_drive/entry.rb
+++ b/gems/google_drive/lib/google_drive/entry.rb
@@ -103,7 +103,7 @@ module GoogleDrive
def preferred_mime_types
# Order is important
# we return the first matching mime type
- %w{
+ %w[
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.oasis.opendocument.text
application/vnd.openxmlformats-officedocument.presentationml.presentation
@@ -111,7 +111,7 @@ module GoogleDrive
application/x-vnd.oasis.opendocument.spreadsheet
application/pdf
application/zip
- }
+ ]
end
end
end
diff --git a/gems/html_text_helper/html_text_helper.gemspec b/gems/html_text_helper/html_text_helper.gemspec
index ba4f73fdd73..e60a992f478 100644
--- a/gems/html_text_helper/html_text_helper.gemspec
+++ b/gems/html_text_helper/html_text_helper.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["zachp@instructure.com", "stephan@pivotallabs.com"]
spec.summary = 'Html text helpers'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/i18n_extraction/i18n_extraction.gemspec b/gems/i18n_extraction/i18n_extraction.gemspec
index 70f6c99c1ec..bdfb21febc4 100644
--- a/gems/i18n_extraction/i18n_extraction.gemspec
+++ b/gems/i18n_extraction/i18n_extraction.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com"]
spec.summary = 'i18n extraction for Instructure'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(Rakefile test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/i18n_tasks/i18n_tasks.gemspec b/gems/i18n_tasks/i18n_tasks.gemspec
index fb02c92edb7..355304292f0 100644
--- a/gems/i18n_tasks/i18n_tasks.gemspec
+++ b/gems/i18n_tasks/i18n_tasks.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com", "stephan@pivotallabs.com"]
spec.summary = 'Instructure i18n tasks gem'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(Rakefile test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/i18n_tasks/lib/tasks/i18n.rake b/gems/i18n_tasks/lib/tasks/i18n.rake
index 2eba3ba1e4c..94759b0fb9a 100755
--- a/gems/i18n_tasks/lib/tasks/i18n.rake
+++ b/gems/i18n_tasks/lib/tasks/i18n.rake
@@ -58,14 +58,14 @@ namespace :i18n do
yaml_dir = './config/locales/generated'
FileUtils.mkdir_p(File.join(yaml_dir))
yaml_file = File.join(yaml_dir, "en.yml")
- special_keys = %w{
+ special_keys = %w[
locales
crowdsourced
custom
bigeasy_locale
fullcalendar_locale
moment_locale
- }.freeze
+ ].freeze
Rails.root.join(yaml_file).open("w") do |file|
file.write(
@@ -445,7 +445,7 @@ namespace :i18n do
languages.split(',')
end
else
- %w(ar zh fr ja pt es ru)
+ %w[ar zh fr ja pt es ru]
end
end
diff --git a/gems/incoming_mail_processor/incoming_mail_processor.gemspec b/gems/incoming_mail_processor/incoming_mail_processor.gemspec
index bc71f9a6e64..40affa40c72 100644
--- a/gems/incoming_mail_processor/incoming_mail_processor.gemspec
+++ b/gems/incoming_mail_processor/incoming_mail_processor.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["jonw@instructure.com"]
spec.summary = 'Read mail from IMAP inbox and process it.'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/incoming_mail_processor/lib/incoming_mail_processor/incoming_message_processor.rb b/gems/incoming_mail_processor/lib/incoming_mail_processor/incoming_message_processor.rb
index 70cf23714cb..70d209a64f6 100644
--- a/gems/incoming_mail_processor/lib/incoming_mail_processor/incoming_message_processor.rb
+++ b/gems/incoming_mail_processor/lib/incoming_mail_processor/incoming_message_processor.rb
@@ -31,7 +31,7 @@ module IncomingMailProcessor
:sqs => IncomingMailProcessor::SqsMailbox,
}.freeze
- ImportantHeaders = %w(To From Subject Content-Type).freeze
+ ImportantHeaders = %w[To From Subject Content-Type].freeze
BULK_PRECEDENCE_VALUES = %w[bulk list junk].freeze
private_constant :BULK_PRECEDENCE_VALUES
diff --git a/gems/incoming_mail_processor/lib/incoming_mail_processor/sqs_mailbox.rb b/gems/incoming_mail_processor/lib/incoming_mail_processor/sqs_mailbox.rb
index f17cceedb53..73c798e141d 100644
--- a/gems/incoming_mail_processor/lib/incoming_mail_processor/sqs_mailbox.rb
+++ b/gems/incoming_mail_processor/lib/incoming_mail_processor/sqs_mailbox.rb
@@ -28,7 +28,7 @@ module IncomingMailProcessor
attr_reader :config
- POLL_PARAMS = %i{idle_timeout wait_time_seconds visibility_timeout}.freeze
+ POLL_PARAMS = %i[idle_timeout wait_time_seconds visibility_timeout].freeze
def initialize(opts = {})
@config = opts
diff --git a/gems/incoming_mail_processor/spec/incoming_mail_processor/directory_mailbox_spec.rb b/gems/incoming_mail_processor/spec/incoming_mail_processor/directory_mailbox_spec.rb
index 194da3eb2bc..46f4e414d5e 100644
--- a/gems/incoming_mail_processor/spec/incoming_mail_processor/directory_mailbox_spec.rb
+++ b/gems/incoming_mail_processor/spec/incoming_mail_processor/directory_mailbox_spec.rb
@@ -46,7 +46,7 @@ describe IncomingMailProcessor::DirectoryMailbox do
describe ".each_message" do
it "iterates through and yield files in a directory" do
folder = default_config[:folder]
- folder_entries = %w(. .. foo bar baz)
+ folder_entries = %w[. .. foo bar baz]
expect(@mailbox).to receive(:files_in_folder).with(folder).and_return(folder_entries)
folder_entries.each do |entry|
expect(@mailbox).to receive(:file?).with(folder, entry).and_return(!entry.include?('.'))
@@ -65,7 +65,7 @@ describe IncomingMailProcessor::DirectoryMailbox do
it "iterates with stride and offset" do
folder = default_config[:folder]
- folder_entries = %w(. .. foo bar baz)
+ folder_entries = %w[. .. foo bar baz]
expect(@mailbox).to receive(:files_in_folder).with(folder).twice.and_return(folder_entries)
folder_entries.each do |entry|
expect(@mailbox).to receive(:file?).with(folder, entry).and_return(!entry.include?('.'))
diff --git a/gems/json_token/json_token.gemspec b/gems/json_token/json_token.gemspec
index 2bdf684eb1a..3583f7bd495 100644
--- a/gems/json_token/json_token.gemspec
+++ b/gems/json_token/json_token.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["nickc@instructure.com", "jrodriguez@pivotallabs.com"]
spec.summary = 'Convenience methods for encoding and decoding a slug of data into base64 encoded JSON'
- spec.files = Dir.glob("{lib}/**/*") + %w(Rakefile)
+ spec.files = Dir.glob("{lib}/**/*") + %w[Rakefile]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/linked_in/linked_in.gemspec b/gems/linked_in/linked_in.gemspec
index 17ad8a405e4..b5f86a64551 100644
--- a/gems/linked_in/linked_in.gemspec
+++ b/gems/linked_in/linked_in.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["brian@instructure.com"]
spec.summary = 'LinkedIn'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/live_events/live_events.gemspec b/gems/live_events/live_events.gemspec
index e7c24d101a1..b345efe95cb 100644
--- a/gems/live_events/live_events.gemspec
+++ b/gems/live_events/live_events.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["zach@instructure.com"]
spec.summary = 'LiveEvents'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb b/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb
index 4bad40c51d0..251507c34d3 100644
--- a/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb
+++ b/gems/lti-advantage/lib/lti_advantage/serializers/jwt_message_serializer.rb
@@ -24,7 +24,7 @@ module LtiAdvantage::Serializers
NRPS_CLAIM_URL = 'https://purl.imsglobal.org/spec/lti-nrps/claim/namesroleservice'
AGS_CLAIM_URL = 'https://purl.imsglobal.org/spec/lti-ags/claim/endpoint'
- STANDARD_IMS_CLAIMS = %w(
+ STANDARD_IMS_CLAIMS = %w[
context
custom
deployment_id
@@ -39,12 +39,12 @@ module LtiAdvantage::Serializers
target_link_uri
lti11_legacy_user_id
lti1p1
- ).freeze
+ ].freeze
- DEEP_LINKING_CLAIMS = %w(
+ DEEP_LINKING_CLAIMS = %w[
deep_linking_settings
content_items
- ).freeze
+ ].freeze
NAMES_AND_ROLES_SERVICE_CLAIM = 'names_and_roles_service'
ASSIGNMENT_AND_GRADE_SERVICE_CLAIM = 'assignment_and_grade_service'
diff --git a/gems/lti-advantage/lti-advantage.gemspec b/gems/lti-advantage/lti-advantage.gemspec
index f0f18211d5c..8339c543f56 100644
--- a/gems/lti-advantage/lti-advantage.gemspec
+++ b/gems/lti-advantage/lti-advantage.gemspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
"public gem pushes."
end
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
diff --git a/gems/lti_outbound/lti_outbound.gemspec b/gems/lti_outbound/lti_outbound.gemspec
index b0b367dfc82..5245f35561a 100644
--- a/gems/lti_outbound/lti_outbound.gemspec
+++ b/gems/lti_outbound/lti_outbound.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/instructure/canvas-lms'
spec.license = 'AGPL'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(LICENSE.txt Rakefile README.md test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[LICENSE.txt Rakefile README.md test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ['lib']
diff --git a/gems/multipart/multipart.gemspec b/gems/multipart/multipart.gemspec
index c533af862e3..8872164a2f7 100644
--- a/gems/multipart/multipart.gemspec
+++ b/gems/multipart/multipart.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com"]
spec.summary = 'Multipart helper to prepare an HTTP POST request with file upload'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/paginated_collection/paginated_collection.gemspec b/gems/paginated_collection/paginated_collection.gemspec
index 4af98e6b90f..148fddd1937 100644
--- a/gems/paginated_collection/paginated_collection.gemspec
+++ b/gems/paginated_collection/paginated_collection.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["brianp@instructure.com"]
spec.summary = 'Paginated Collection gem'
- spec.files = Dir.glob("{lib}/**/*") + %w(Rakefile)
+ spec.files = Dir.glob("{lib}/**/*") + %w[Rakefile]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/paginated_collection/spec/paginated_collection/paginated_collection_spec.rb b/gems/paginated_collection/spec/paginated_collection/paginated_collection_spec.rb
index 70dee28b7d8..d70ad21fc72 100644
--- a/gems/paginated_collection/spec/paginated_collection/paginated_collection_spec.rb
+++ b/gems/paginated_collection/spec/paginated_collection/paginated_collection_spec.rb
@@ -40,7 +40,7 @@ describe PaginatedCollection do
expect(items.current_page).to eq 1
expect(items.per_page).to eq 5
expect(items.last_page).to eq 1
- %w(first_page next_page previous_page total_entries).each do |a|
+ %w[first_page next_page previous_page total_entries].each do |a|
expect(items.send(a)).to be_nil
end
end
diff --git a/gems/plugins/academic_benchmark/lib/academic_benchmark/engine.rb b/gems/plugins/academic_benchmark/lib/academic_benchmark/engine.rb
index 11ceee3406f..257a6465701 100644
--- a/gems/plugins/academic_benchmark/lib/academic_benchmark/engine.rb
+++ b/gems/plugins/academic_benchmark/lib/academic_benchmark/engine.rb
@@ -35,7 +35,7 @@ module AcademicBenchmark
:worker => 'CCWorker',
:converter_class => AcademicBenchmark::Converter,
:provides => { :academic_benchmark => AcademicBenchmark::Converter },
- :valid_contexts => %w{Account}
+ :valid_contexts => %w[Account]
}
}
end
diff --git a/gems/plugins/account_reports/lib/account_reports/outcome_export.rb b/gems/plugins/account_reports/lib/account_reports/outcome_export.rb
index b033a683015..c81b7617064 100644
--- a/gems/plugins/account_reports/lib/account_reports/outcome_export.rb
+++ b/gems/plugins/account_reports/lib/account_reports/outcome_export.rb
@@ -29,8 +29,8 @@ module AccountReports
include_deleted_objects
end
- NO_SCORE_HEADERS = %w(vendor_guid object_type title description display_name parent_guids workflow_state).freeze
- OUTCOME_EXPORT_SCALAR_HEADERS = %w(vendor_guid object_type title description display_name calculation_method calculation_int parent_guids workflow_state mastery_points).freeze
+ NO_SCORE_HEADERS = %w[vendor_guid object_type title description display_name parent_guids workflow_state].freeze
+ OUTCOME_EXPORT_SCALAR_HEADERS = %w[vendor_guid object_type title description display_name calculation_method calculation_int parent_guids workflow_state mastery_points].freeze
OUTCOME_EXPORT_HEADERS = (OUTCOME_EXPORT_SCALAR_HEADERS + ['ratings']).freeze
def outcome_export
diff --git a/gems/plugins/account_reports/lib/account_reports/outcome_reports.rb b/gems/plugins/account_reports/lib/account_reports/outcome_reports.rb
index 526f1075c1a..b378d350059 100644
--- a/gems/plugins/account_reports/lib/account_reports/outcome_reports.rb
+++ b/gems/plugins/account_reports/lib/account_reports/outcome_reports.rb
@@ -116,66 +116,70 @@ module AccountReports
:root_account_id => root_account.id
}
students = root_account.pseudonyms.except(:preload)
- .select(%{
- pseudonyms.id,
- u.sortable_name AS "student name",
- pseudonyms.user_id AS "student id",
- pseudonyms.sis_user_id AS "student sis id",
- a.title AS "assignment title",
- a.id AS "assignment id",
- sub.submitted_at AS "submission date",
- sub.score AS "submission score",
- lo.short_description AS "learning outcome name",
- lo.id AS "learning outcome id",
- lo.display_name AS "learning outcome friendly name",
- lo.data AS "learning outcome data",
- r.attempt AS "attempt",
- r.hide_points AS "learning outcome points hidden",
- r.score AS "outcome score",
- r.possible AS "learning outcome points possible",
- r.mastery AS "learning outcome mastered",
- c.name AS "course name",
- c.id AS "course id",
- c.sis_source_id AS "course sis id",
- s.name AS "section name",
- s.id AS "section id",
- s.sis_source_id AS "section sis id",
- e.workflow_state AS "enrollment state",
- lo.context_id AS "outcome context id",
- lo.context_type AS "outcome context type",
- acct.id AS "account id",
- acct.name AS "account name"})
- .joins(Pseudonym.send(:sanitize_sql, ["
- INNER JOIN #{User.quoted_table_name} u ON pseudonyms.user_id = u.id
- INNER JOIN (
- SELECT user_id, course_id, course_section_id, workflow_state
- FROM #{Enrollment.quoted_table_name}
- WHERE type = 'StudentEnrollment'
- AND root_account_id = :root_account_id
- " + (@include_deleted ? "" : "AND workflow_state <> 'deleted'") + "
- GROUP BY user_id, course_id, course_section_id, workflow_state
- ) e ON pseudonyms.user_id = e.user_id
- INNER JOIN #{Course.quoted_table_name} c ON c.id = e.course_id
- AND c.root_account_id = :root_account_id
- INNER JOIN #{Account.quoted_table_name} acct ON acct.id = c.account_id
- INNER JOIN #{CourseSection.quoted_table_name} s ON s.id = e.course_section_id
- INNER JOIN #{Assignment.quoted_table_name} a ON (a.context_id = c.id
- AND a.context_type = 'Course')
- INNER JOIN #{ContentTag.quoted_table_name} ct ON (ct.content_id = a.id
- AND ct.content_type = 'Assignment')
- INNER JOIN #{LearningOutcome.quoted_table_name} lo ON lo.id = ct.learning_outcome_id
- INNER JOIN #{ContentTag.quoted_table_name} lol ON lol.content_id = lo.id
- AND lol.context_id = :account_id
- AND lol.context_type = 'Account'
- AND lol.tag_type = 'learning_outcome_association'
- AND lol.workflow_state != 'deleted'
- LEFT JOIN #{LearningOutcomeResult.quoted_table_name} r ON (r.user_id=pseudonyms.user_id
- AND r.content_tag_id = ct.id)
- LEFT JOIN #{Submission.quoted_table_name} sub ON sub.assignment_id = a.id
- AND sub.user_id = pseudonyms.user_id AND sub.workflow_state <> 'deleted'
- AND sub.workflow_state <> 'unsubmitted'", parameters]))
- .where("ct.tag_type = 'learning_outcome' AND ct.workflow_state <> 'deleted'
- AND (r.id IS NULL OR (r.workflow_state <> 'deleted' AND r.artifact_type IS NOT NULL AND r.artifact_type <> 'Submission'))")
+ .select(<<~SQL.squish)
+ pseudonyms.id,
+ u.sortable_name AS "student name",
+ pseudonyms.user_id AS "student id",
+ pseudonyms.sis_user_id AS "student sis id",
+ a.title AS "assignment title",
+ a.id AS "assignment id",
+ sub.submitted_at AS "submission date",
+ sub.score AS "submission score",
+ lo.short_description AS "learning outcome name",
+ lo.id AS "learning outcome id",
+ lo.display_name AS "learning outcome friendly name",
+ lo.data AS "learning outcome data",
+ r.attempt AS "attempt",
+ r.hide_points AS "learning outcome points hidden",
+ r.score AS "outcome score",
+ r.possible AS "learning outcome points possible",
+ r.mastery AS "learning outcome mastered",
+ c.name AS "course name",
+ c.id AS "course id",
+ c.sis_source_id AS "course sis id",
+ s.name AS "section name",
+ s.id AS "section id",
+ s.sis_source_id AS "section sis id",
+ e.workflow_state AS "enrollment state",
+ lo.context_id AS "outcome context id",
+ lo.context_type AS "outcome context type",
+ acct.id AS "account id",
+ acct.name AS "account name"
+ SQL
+ .joins(Pseudonym.send(:sanitize_sql, [<<~SQL.squish, parameters]))
+ INNER JOIN #{User.quoted_table_name} u ON pseudonyms.user_id = u.id
+ INNER JOIN (
+ SELECT user_id, course_id, course_section_id, workflow_state
+ FROM #{Enrollment.quoted_table_name}
+ WHERE type = 'StudentEnrollment'
+ AND root_account_id = :root_account_id
+ #{"AND workflow_state <> 'deleted'" unless @include_deleted}
+ GROUP BY user_id, course_id, course_section_id, workflow_state
+ ) e ON pseudonyms.user_id = e.user_id
+ INNER JOIN #{Course.quoted_table_name} c ON c.id = e.course_id
+ AND c.root_account_id = :root_account_id
+ INNER JOIN #{Account.quoted_table_name} acct ON acct.id = c.account_id
+ INNER JOIN #{CourseSection.quoted_table_name} s ON s.id = e.course_section_id
+ INNER JOIN #{Assignment.quoted_table_name} a ON (a.context_id = c.id
+ AND a.context_type = 'Course')
+ INNER JOIN #{ContentTag.quoted_table_name} ct ON (ct.content_id = a.id
+ AND ct.content_type = 'Assignment')
+ INNER JOIN #{LearningOutcome.quoted_table_name} lo ON lo.id = ct.learning_outcome_id
+ INNER JOIN #{ContentTag.quoted_table_name} lol ON lol.content_id = lo.id
+ AND lol.context_id = :account_id
+ AND lol.context_type = 'Account'
+ AND lol.tag_type = 'learning_outcome_association'
+ AND lol.workflow_state != 'deleted'
+ LEFT JOIN #{LearningOutcomeResult.quoted_table_name} r ON (r.user_id=pseudonyms.user_id
+ AND r.content_tag_id = ct.id)
+ LEFT JOIN #{Submission.quoted_table_name} sub ON sub.assignment_id = a.id
+ AND sub.user_id = pseudonyms.user_id AND sub.workflow_state <> 'deleted'
+ AND sub.workflow_state <> 'unsubmitted'
+ SQL
+ .where(<<~SQL.squish)
+ ct.tag_type = 'learning_outcome' AND ct.workflow_state <> 'deleted'
+ AND (r.id IS NULL OR (r.workflow_state <> 'deleted' AND r.artifact_type IS NOT NULL AND r.artifact_type <> 'Submission'))
+ SQL
unless @include_deleted
students = students.where("pseudonyms.workflow_state<>'deleted' AND c.workflow_state IN ('available', 'completed')")
@@ -261,7 +265,7 @@ module AccountReports
def outcome_order
param = @account_report.value_for_param('order')
param = param.downcase if param
- order_options = %w(users courses outcomes)
+ order_options = %w[users courses outcomes]
select = order_options & [param]
order_sql = { 'users' => 'u.id, learning_outcomes.id, c.id',
diff --git a/gems/plugins/account_reports/lib/account_reports/report_helper.rb b/gems/plugins/account_reports/lib/account_reports/report_helper.rb
index 43bf727fe1d..0480333071b 100644
--- a/gems/plugins/account_reports/lib/account_reports/report_helper.rb
+++ b/gems/plugins/account_reports/lib/account_reports/report_helper.rb
@@ -274,7 +274,7 @@ module AccountReports::ReportHelper
end
def valid_enrollment_workflow_states
- %w(invited creation_pending active completed inactive deleted rejected).freeze &
+ %w[invited creation_pending active completed inactive deleted rejected].freeze &
Api.value_to_array(@account_report.parameters["enrollment_states"])
end
diff --git a/gems/plugins/account_reports/spec_canvas/sis_provisioning_reports_spec.rb b/gems/plugins/account_reports/spec_canvas/sis_provisioning_reports_spec.rb
index 067bbd988e9..c600fb077d4 100644
--- a/gems/plugins/account_reports/spec_canvas/sis_provisioning_reports_spec.rb
+++ b/gems/plugins/account_reports/spec_canvas/sis_provisioning_reports_spec.rb
@@ -320,11 +320,11 @@ describe "Default Account Reports" do
header = case format
when 'sis'
- %w(user_id integration_id authentication_provider_id login_id password first_name last_name
- full_name sortable_name short_name email status)
+ %w[user_id integration_id authentication_provider_id login_id password first_name last_name
+ full_name sortable_name short_name email status]
when 'provisioning'
- %w(canvas_user_id user_id integration_id authentication_provider_id login_id first_name last_name
- full_name sortable_name short_name email status created_by_sis)
+ %w[canvas_user_id user_id integration_id authentication_provider_id login_id first_name last_name
+ full_name sortable_name short_name email status created_by_sis]
end
header << 'pronouns' if @report.should_add_pronouns?
header
diff --git a/gems/plugins/moodle_importer/lib/moodle_importer/engine.rb b/gems/plugins/moodle_importer/lib/moodle_importer/engine.rb
index eafdc0f23c4..d8bab860314 100644
--- a/gems/plugins/moodle_importer/lib/moodle_importer/engine.rb
+++ b/gems/plugins/moodle_importer/lib/moodle_importer/engine.rb
@@ -36,7 +36,7 @@ module Moodle
:migration_partial => 'moodle_config',
:worker => 'CCWorker',
:provides => { :moodle_1_9 => Moodle::Converter, :moodle_2 => Moodle::Converter },
- :valid_contexts => %w{Account Course}
+ :valid_contexts => %w[Account Course]
}
}
end
diff --git a/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb b/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb
index 3fbbf2fc815..3722a69560a 100644
--- a/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb
+++ b/gems/plugins/qti_exporter/lib/qti/assessment_item_converter.rb
@@ -148,7 +148,7 @@ module Qti
if @migration_type and UNSUPPORTED_TYPES.member?(@migration_type)
@question[:question_type] = @migration_type
@question[:unsupported] = true
- elsif !%w(text_only_question file_upload_question).include?(@migration_type)
+ elsif !%w[text_only_question file_upload_question].include?(@migration_type)
self.parse_question_data
else
self.get_feedback if @migration_type == 'file_upload_question'
diff --git a/gems/plugins/qti_exporter/lib/qti_exporter/engine.rb b/gems/plugins/qti_exporter/lib/qti_exporter/engine.rb
index 9f365e90225..2a93392122d 100644
--- a/gems/plugins/qti_exporter/lib/qti_exporter/engine.rb
+++ b/gems/plugins/qti_exporter/lib/qti_exporter/engine.rb
@@ -39,7 +39,7 @@ module QtiExporter
:requires_file_upload => true,
:provides => { :qti => Qti::Converter,
:webct => Qti::Converter, }, # It can import WebCT Quizzes
- :valid_contexts => %w{Account Course}
+ :valid_contexts => %w[Account Course]
},
:validator => 'QtiPluginValidator'
}
diff --git a/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb b/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb
index a59e7b7589d..190de4c3476 100644
--- a/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb
+++ b/gems/plugins/qti_exporter/spec_canvas/lib/qti/assessment_test_converter_spec.rb
@@ -41,7 +41,7 @@ describe Qti::AssessmentTestConverter do
def test_section(select)
Nokogiri::XML(<<~XML).at_css('testPart')
- #{select && %Q{}}
+ #{select && %Q()}
XML
end
diff --git a/gems/plugins/qti_exporter/spec_canvas/qti_exporter_spec.rb b/gems/plugins/qti_exporter/spec_canvas/qti_exporter_spec.rb
index 03a691dab9a..f6966760456 100644
--- a/gems/plugins/qti_exporter/spec_canvas/qti_exporter_spec.rb
+++ b/gems/plugins/qti_exporter/spec_canvas/qti_exporter_spec.rb
@@ -337,7 +337,7 @@ if Qti.migration_executable
expect(d['answers'].map { |a| a['weight'] }).to eq [0, 100, 0]
expect(d['answers'].map { |a| a['comments'] }).to eq ['nope', 'yes!', nil]
attachment = @course.attachments.detect { |a| a.filename == 'smiley.jpg' }
- expect(d['answers'].map { |a| a['comments_html'] }).to eq [nil, %{yes! }, nil]
+ expect(d['answers'].map { |a| a['comments_html'] }).to eq [nil, %(yes! ), nil]
end
it "imports respondus question types" do
diff --git a/gems/plugins/respondus_soap_endpoint/lib/respondus_soap_endpoint/urn_RespondusAPIServant.rb b/gems/plugins/respondus_soap_endpoint/lib/respondus_soap_endpoint/urn_RespondusAPIServant.rb
index f07d33ec606..f525dd9acba 100644
--- a/gems/plugins/respondus_soap_endpoint/lib/respondus_soap_endpoint/urn_RespondusAPIServant.rb
+++ b/gems/plugins/respondus_soap_endpoint/lib/respondus_soap_endpoint/urn_RespondusAPIServant.rb
@@ -107,7 +107,7 @@ module RespondusSoapEndpoint
end
def load_user(method, userName, password)
- return nil if %w(identifyServer).include?(method.to_s)
+ return nil if %w[identifyServer].include?(method.to_s)
domain_root_account = rack_env['canvas.domain_root_account'] || Account.default
if userName == OAUTH_TOKEN_USERNAME
@@ -142,7 +142,7 @@ module RespondusSoapEndpoint
userName, password, context, *args = args
Rails.logger.debug "\nProcessing RespondusSoapApi##{method} (for #{rack_env['REMOTE_ADDR']} at #{Time.now}) [SOAP]"
log_args = args.dup
- log_args.pop if %w(publishServerItem replaceServerItem appendServerItem).include?(method.to_s)
+ log_args.pop if %w[publishServerItem replaceServerItem appendServerItem].include?(method.to_s)
Rails.logger.debug "Parameters: #{([userName, "[FILTERED]", context] + log_args).inspect}"
load_user(method, userName, password)
load_session(context)
@@ -203,10 +203,10 @@ module RespondusSoapEndpoint
# identification C_String - {http://www.w3.org/2001/XMLSchema}string
#
def identifyServer(_userName, _password, _context)
- [%{
+ [%(
Respondus Generic Server API
Contract version: 1
-Implemented for: Canvas LMS}]
+Implemented for: Canvas LMS)]
end
# SYNOPSIS
@@ -535,7 +535,7 @@ Implemented for: Canvas LMS}]
return poll_for_completion()
end
- unless %w(quiz qdb).include?(itemType)
+ unless %w[quiz qdb].include?(itemType)
raise OtherError, "Invalid item type"
end
if uploadType != 'zipPackage'
diff --git a/gems/plugins/respondus_soap_endpoint/spec_canvas/integration/respondus_endpoint_spec.rb b/gems/plugins/respondus_soap_endpoint/spec_canvas/integration/respondus_endpoint_spec.rb
index 55a075f07a5..a580aa95309 100644
--- a/gems/plugins/respondus_soap_endpoint/spec_canvas/integration/respondus_endpoint_spec.rb
+++ b/gems/plugins/respondus_soap_endpoint/spec_canvas/integration/respondus_endpoint_spec.rb
@@ -72,10 +72,10 @@ describe "Respondus SOAP API", type: :request do
it "identifies the server without user credentials" do
soap_response = soap_request('IdentifyServer', '', '', '')
expect(soap_response.first).to eq "Success"
- expect(soap_response.last).to eq %{
+ expect(soap_response.last).to eq %(
Respondus Generic Server API
Contract version: 1
-Implemented for: Canvas LMS}
+Implemented for: Canvas LMS)
end
it "authenticates an existing user" do
diff --git a/gems/request_context/request_context.gemspec b/gems/request_context/request_context.gemspec
index 625d083b506..9332d76fff2 100644
--- a/gems/request_context/request_context.gemspec
+++ b/gems/request_context/request_context.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["evizitei@instructure.com"]
spec.summary = 'Instructure gem for managing http request metadata'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/rubocop-canvas/rubocop-canvas.gemspec b/gems/rubocop-canvas/rubocop-canvas.gemspec
index ec236d304dd..b1fe5754dc4 100644
--- a/gems/rubocop-canvas/rubocop-canvas.gemspec
+++ b/gems/rubocop-canvas/rubocop-canvas.gemspec
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
spec.email = ["brianp@instructure.com"]
spec.summary = 'custom cops for canvas'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/lint/no_file_utils_rm_rf_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/lint/no_file_utils_rm_rf_spec.rb
index e55b413a4c2..664ade8b676 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/lint/no_file_utils_rm_rf_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/lint/no_file_utils_rm_rf_spec.rb
@@ -21,11 +21,11 @@ describe RuboCop::Cop::Lint::NoFileUtilsRmRf do
subject(:cop) { described_class.new }
it 'disallows FileUtils.rm_rf' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
def rm_sekrets
FileUtils.rm_rf
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/avoid FileUtils.rm_rf/)
expect(cop.offenses.first.severity.name).to eq(:warning)
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/lint/no_sleep_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/lint/no_sleep_spec.rb
index 1933a812e83..34c776f9785 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/lint/no_sleep_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/lint/no_sleep_spec.rb
@@ -26,13 +26,13 @@ describe RuboCop::Cop::Lint::NoSleep do
end
it 'disallows sleep' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class KnightsController < ApplicationController
def find_sword
sleep 999
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/tie up this process/)
expect(cop.offenses.first.severity.name).to eq(:error)
@@ -45,13 +45,13 @@ describe RuboCop::Cop::Lint::NoSleep do
end
it 'disallows sleep' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
describe "Alerts" do
it "should validate the form" do
sleep 2
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/consider: Timecop/)
expect(cop.offenses.first.severity.name).to eq(:warning)
@@ -64,13 +64,13 @@ describe RuboCop::Cop::Lint::NoSleep do
end
it 'disallows sleep' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class BookmarkService < UserService
def find_bookmarks(query)
sleep Time.now - last_get
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to eq("Avoid using sleep.")
expect(cop.offenses.first.severity.name).to eq(:warning)
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/migration/non_transactional_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/migration/non_transactional_spec.rb
index 217d558e2f1..c74f9e4e5df 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/migration/non_transactional_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/migration/non_transactional_spec.rb
@@ -21,33 +21,33 @@ describe RuboCop::Cop::Migration::NonTransactional do
subject(:cop) { described_class.new }
it 'complains about concurrent indexes in ddl transaction' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
def up
add_index :my_index, algorithm: :concurrently
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/disable_ddl/)
expect(cop.offenses.first.severity.name).to eq(:warning)
end
it 'ignores non-concurrent indexes' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
def up
add_index :my_index
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
it 'is ok with concurrent indexes added non-transactionally' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
disable_ddl_transaction!
@@ -55,12 +55,12 @@ describe RuboCop::Cop::Migration::NonTransactional do
add_index :my_index, algorithm: :concurrently, if_not_exists: true
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
it 'complains about missing if_not_exists for add_index' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
disable_ddl_transaction!
@@ -68,14 +68,14 @@ describe RuboCop::Cop::Migration::NonTransactional do
add_index :my_index
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/if_not_exists/)
expect(cop.offenses.first.severity.name).to eq(:warning)
end
it 'complains about missing if_not_exists for add_column' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
disable_ddl_transaction!
@@ -83,36 +83,36 @@ describe RuboCop::Cop::Migration::NonTransactional do
add_column :table, :column, :type
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/if_not_exists/)
expect(cop.offenses.first.severity.name).to eq(:warning)
end
it 'is ok about missing if_not_exists for add_index when transactional' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
def up
add_index :my_index
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
it 'is ok about missing if_not_exists for add_column when transactional' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
def up
add_column :table, :column, :type
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
it 'is ok about if_not_exists for add_index' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
disable_ddl_transaction!
@@ -120,12 +120,12 @@ describe RuboCop::Cop::Migration::NonTransactional do
add_index :my_index, if_not_exists: true
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
it 'is ok about if_not_exists for add_column' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
disable_ddl_transaction!
@@ -133,12 +133,12 @@ describe RuboCop::Cop::Migration::NonTransactional do
add_column :table, :column, :type, if_not_exists: true
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
it 'complains about missing if_exists on remove_foreign_key' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class TestMigration < ActiveRecord::Migration
disable_ddl_transaction!
@@ -146,7 +146,7 @@ describe RuboCop::Cop::Migration::NonTransactional do
remove_foreign_key :table, :column
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/if_exists/)
expect(cop.offenses.first.severity.name).to eq(:warning)
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/migration/remove_column_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/migration/remove_column_spec.rb
index 1b190ce4330..dfd69efbc98 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/migration/remove_column_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/migration/remove_column_spec.rb
@@ -22,7 +22,7 @@ describe RuboCop::Cop::Migration::RemoveColumn do
context 'predeploy' do
it 'disallows remove_column in `up`' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class MyMigration < ActiveRecord::Migration
tag :predeploy
@@ -30,14 +30,14 @@ describe RuboCop::Cop::Migration::RemoveColumn do
remove_column :x, :y
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/column removal/)
expect(cop.offenses.first.severity.name).to eq(:error)
end
it 'disallows remove_column in `self.up`' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class MyMigration < ActiveRecord::Migration
tag :predeploy
@@ -45,14 +45,14 @@ describe RuboCop::Cop::Migration::RemoveColumn do
remove_column :x, :y
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/column removal/)
expect(cop.offenses.first.severity.name).to eq(:error)
end
it 'disallows remove_column in `change`' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class MyMigration < ActiveRecord::Migration
tag :predeploy
@@ -60,14 +60,14 @@ describe RuboCop::Cop::Migration::RemoveColumn do
remove_column :x, :y
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/column removal/)
expect(cop.offenses.first.severity.name).to eq(:error)
end
it 'disallows a bunch of other column removal methods' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class MyMigration < ActiveRecord::Migration
tag :predeploy
@@ -82,12 +82,12 @@ describe RuboCop::Cop::Migration::RemoveColumn do
remove_columns :y, :z
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(6)
end
it 'allows remove_column in `down`' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class MyMigration < ActiveRecord::Migration
tag :predeploy
@@ -95,7 +95,7 @@ describe RuboCop::Cop::Migration::RemoveColumn do
remove_column :x, :y
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/specs/no_no_such_element_error_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/specs/no_no_such_element_error_spec.rb
index 8ff081ce111..1e48e578c82 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/specs/no_no_such_element_error_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/specs/no_no_such_element_error_spec.rb
@@ -23,40 +23,40 @@ describe RuboCop::Cop::Specs::NoNoSuchElementError do
let(:msg_regex) { /Avoid using Selenium::WebDriver::Error::NoSuchElementError/ }
it 'disallows Selenium::WebDriver::Error::NoSuchElementError' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
describe "breaks all the things" do
it 'is a bad spec' do
Selenium::WebDriver::Error::NoSuchElementError
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(msg_regex)
expect(cop.offenses.first.severity.name).to eq(:warning)
end
it 'disallows rescuing Selenium::WebDriver::Error::NoSuchElementError' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
def not_found?
find("#yar")
false
rescue Selenium::WebDriver::Error::NoSuchElementError
true
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(msg_regex)
expect(cop.offenses.first.severity.name).to eq(:warning)
end
it 'disallows raising Selenium::WebDriver::Error::NoSuchElementError' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
def not_found?
a = find("#yar")
return true if a
raise Selenium::WebDriver::Error::NoSuchElementError
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(msg_regex)
expect(cop.offenses.first.severity.name).to eq(:warning)
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_helper_modules_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_helper_modules_spec.rb
index d21c71c93dc..0e43ceff2e2 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_helper_modules_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_helper_modules_spec.rb
@@ -22,89 +22,89 @@ describe RuboCop::Cop::Specs::ScopeHelperModules do
context "within class" do
it 'allows defs' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
class CombatArmband
def laserbeams
"PEWPEWPEPWEPWPEW"
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
context "within context" do
it 'allows defs' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
context "Jumpity JumpStick" do
def jump_and_jab
puts "heeeeeya!"
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
context "within describe" do
it 'allows defs' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
describe JumpStick do
def zappy_zap
puts "yarrwafeiowhf"
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
context "within module" do
it 'allows defs' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
module JumpStick
def jumpy
puts "vroom"
puts "vroom"
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
context "within shared_context" do
it 'allows defs' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
shared_context "in-process server selenium tests" do
def bat_poo
"splat!"
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
context "within shared_examples" do
it 'allows defs' do
- inspect_source(%{
+ inspect_source(<<~RUBY)
shared_examples '[:correct]' do
def pirates
"attaaaaaaaack!"
end
end
- })
+ RUBY
expect(cop.offenses.size).to eq(0)
end
end
it "disallows defs on Object" do
- inspect_source(%{
+ inspect_source(<<~RUBY)
def crow_tornado_so_op
puts "yoo"
end
- })
+ RUBY
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/Define all helper/)
expect(cop.offenses.first.severity.name).to eq(:warning)
diff --git a/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_includes_spec.rb b/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_includes_spec.rb
index 4c3c80ebe82..a38898a5d2c 100644
--- a/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_includes_spec.rb
+++ b/gems/rubocop-canvas/spec/rubocop/cop/specs/scope_includes_spec.rb
@@ -22,30 +22,30 @@ describe RuboCop::Cop::Specs::ScopeIncludes do
context "within describe" do
it 'allows includes' do
- inspect_source(%{
+ inspect_source(%(
describe JumpStick do
include Foo
end
- })
+ ))
expect(cop.offenses.size).to eq(0)
end
end
context "within module" do
it 'allows includes' do
- inspect_source(%{
+ inspect_source(%(
module JumpStick
include Foo
end
- })
+ ))
expect(cop.offenses.size).to eq(0)
end
end
it "disallows defs on Object" do
- inspect_source(%{
+ inspect_source(%(
include Foo
- })
+ ))
expect(cop.offenses.size).to eq(1)
expect(cop.messages.first).to match(/Never `include`/)
expect(cop.offenses.first.severity.name).to eq(:error)
diff --git a/gems/turnitin_api/lib/turnitin_api/outcomes_response_transformer.rb b/gems/turnitin_api/lib/turnitin_api/outcomes_response_transformer.rb
index 554dce7d1b1..c817a8e0829 100644
--- a/gems/turnitin_api/lib/turnitin_api/outcomes_response_transformer.rb
+++ b/gems/turnitin_api/lib/turnitin_api/outcomes_response_transformer.rb
@@ -49,7 +49,7 @@ module TurnitinApi
end
def originality_data
- response.body['outcome_originalityreport'].select { |k, _| %w(breakdown numeric).include?(k) }
+ response.body['outcome_originalityreport'].select { |k, _| %w[breakdown numeric].include?(k) }
end
def uploaded_at
diff --git a/gems/twitter/twitter.gemspec b/gems/twitter/twitter.gemspec
index deb5a785dc0..adb2fc427dd 100644
--- a/gems/twitter/twitter.gemspec
+++ b/gems/twitter/twitter.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["rweiner@pivotallabs.com"]
spec.summary = 'Gem for posting to Twitter'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/gems/utf8_cleaner/utf8_cleaner.gemspec b/gems/utf8_cleaner/utf8_cleaner.gemspec
index f426b76c8c3..1d8b78a6a6a 100644
--- a/gems/utf8_cleaner/utf8_cleaner.gemspec
+++ b/gems/utf8_cleaner/utf8_cleaner.gemspec
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.email = ["zachp@instructure.com", "stephan@pivotallabs.com"]
spec.summary = 'Strip invalid UTF8 characters'
- spec.files = Dir.glob("{lib,spec}/**/*") + %w(Rakefile test.sh)
+ spec.files = Dir.glob("{lib,spec}/**/*") + %w[Rakefile test.sh]
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
diff --git a/lib/api.rb b/lib/api.rb
index 63409a71772..83cbc90c53b 100644
--- a/lib/api.rb
+++ b/lib/api.rb
@@ -420,7 +420,7 @@ module Api
PAGINATION_PARAMS = [:current, :next, :prev, :first, :last].freeze
LINK_PRIORITY = [:next, :last, :prev, :current, :first].freeze
- EXCLUDE_IN_PAGINATION_LINKS = %w(page per_page access_token api_key).freeze
+ EXCLUDE_IN_PAGINATION_LINKS = %w[page per_page access_token api_key].freeze
def self.build_links(base_url, opts = {})
links = build_links_hash(base_url, opts)
build_links_from_hash(links)
diff --git a/lib/api/html/content.rb b/lib/api/html/content.rb
index e63ebe366f1..ab931fb234e 100644
--- a/lib/api/html/content.rb
+++ b/lib/api/html/content.rb
@@ -158,7 +158,7 @@ module Api
private
- APPLICABLE_ATTRS = %w{href src}.freeze
+ APPLICABLE_ATTRS = %w[href src].freeze
def scrub_links!(node)
APPLICABLE_ATTRS.each do |attr|
diff --git a/lib/api/v1/account.rb b/lib/api/v1/account.rb
index 81f69967f0f..ea8572c0f7f 100644
--- a/lib/api/v1/account.rb
+++ b/lib/api/v1/account.rb
@@ -36,7 +36,7 @@ module Api::V1::Account
end
def account_json(account, user, session, includes, read_only = false)
- attributes = %w(id name parent_account_id root_account_id workflow_state uuid)
+ attributes = %w[id name parent_account_id root_account_id workflow_state uuid]
if read_only
return api_json(account, user, session, :only => attributes).tap do |hash|
hash['root_account_id'] = nil if account.root_account?
@@ -44,7 +44,7 @@ module Api::V1::Account
end
end
- methods = %w(default_storage_quota_mb default_user_storage_quota_mb default_group_storage_quota_mb)
+ methods = %w[default_storage_quota_mb default_user_storage_quota_mb default_group_storage_quota_mb]
api_json(account, user, session, :only => attributes, :methods => methods).tap do |hash|
hash['root_account_id'] = nil if account.root_account?
hash['default_time_zone'] = account.default_time_zone.tzinfo.name
diff --git a/lib/api/v1/account_notifications.rb b/lib/api/v1/account_notifications.rb
index 7d2e94165b9..6b7770b8f6a 100644
--- a/lib/api/v1/account_notifications.rb
+++ b/lib/api/v1/account_notifications.rb
@@ -26,7 +26,7 @@ module Api::V1::AccountNotifications
end
def account_notification_json(account_notification, user, session)
- json = api_json(account_notification, user, session, :only => %w(id subject start_at end_at icon message))
+ json = api_json(account_notification, user, session, :only => %w[id subject start_at end_at icon message])
json['role_ids'] = account_notification.account_notification_roles.map(&:role_id)
json['roles'] = account_notification.account_notification_roles.map(&:role_name)
json
diff --git a/lib/api/v1/account_report.rb b/lib/api/v1/account_report.rb
index d352571a9b4..4623d7760d0 100644
--- a/lib/api/v1/account_report.rb
+++ b/lib/api/v1/account_report.rb
@@ -29,7 +29,7 @@ module Api::V1::AccountReport
end
def account_report_json(report, user)
- json = api_json(report, user, nil, only: %w(id progress parameters current_line))
+ json = api_json(report, user, nil, only: %w[id progress parameters current_line])
json[:status] = report.workflow_state
json[:report] = report.report_type
json[:created_at] = report.created_at&.iso8601
diff --git a/lib/api/v1/assessment_request.rb b/lib/api/v1/assessment_request.rb
index c765a002a97..7bcc982d8e2 100644
--- a/lib/api/v1/assessment_request.rb
+++ b/lib/api/v1/assessment_request.rb
@@ -25,7 +25,7 @@ module Api::V1::AssessmentRequest
def assessment_request_json(assessment_request, user, session, includes = Set.new)
assignment = assessment_request.asset.assignment
- json_attributes = %w(id user_id assessor_id asset_id asset_type workflow_state)
+ json_attributes = %w[id user_id assessor_id asset_id asset_type workflow_state]
if assignment.anonymous_peer_reviews? && !assignment.grants_any_right?(user, session, :grade)
json_attributes.delete('assessor_id')
end
diff --git a/lib/api/v1/assignment.rb b/lib/api/v1/assignment.rb
index 12f8942de35..b4896cf33f6 100644
--- a/lib/api/v1/assignment.rb
+++ b/lib/api/v1/assignment.rb
@@ -33,7 +33,7 @@ module Api::V1::Assignment
:rubric_association].freeze
API_ALLOWED_ASSIGNMENT_OUTPUT_FIELDS = {
- :only => %w(
+ :only => %w[
id
position
description
@@ -64,11 +64,11 @@ module Api::V1::Assignment
anonymous_grading
allowed_attempts
annotatable_attachment_id
- )
+ ]
}.freeze
API_ASSIGNMENT_NEW_RECORD_FIELDS = {
- :only => %w(
+ :only => %w[
graders_anonymous_to_graders
grader_comments_visible_to_graders
grader_names_visible_to_final_grader
@@ -77,7 +77,7 @@ module Api::V1::Assignment
assignment_group_id
post_to_sis
annotatable_attachment_id
- )
+ ]
}.freeze
EDITABLE_ATTRS_IN_CLOSED_GRADING_PERIOD = %w[
@@ -455,7 +455,7 @@ module Api::V1::Assignment
settings.slice(*API_ALLOWED_VERICITE_SETTINGS)
end
- API_ALLOWED_ASSIGNMENT_INPUT_FIELDS = %w(
+ API_ALLOWED_ASSIGNMENT_INPUT_FIELDS = %w[
name
description
position
@@ -489,9 +489,9 @@ module Api::V1::Assignment
anonymous_instructor_annotations
allowed_attempts
important_dates
- ).freeze
+ ].freeze
- API_ALLOWED_TURNITIN_SETTINGS = %w(
+ API_ALLOWED_TURNITIN_SETTINGS = %w[
originality_report_visibility
s_paper_check
internet_check
@@ -501,14 +501,14 @@ module Api::V1::Assignment
exclude_small_matches_type
exclude_small_matches_value
submit_papers_to
- ).freeze
+ ].freeze
- API_ALLOWED_VERICITE_SETTINGS = %w(
+ API_ALLOWED_VERICITE_SETTINGS = %w[
originality_report_visibility
exclude_quoted
exclude_self_plag
store_in_index
- ).freeze
+ ].freeze
def create_api_assignment(assignment, assignment_params, user, context = assignment.context, calculate_grades: nil)
return :forbidden unless grading_periods_allow_submittable_create?(assignment, assignment_params)
diff --git a/lib/api/v1/assignment_group.rb b/lib/api/v1/assignment_group.rb
index 697dd403db2..54fc59d4137 100644
--- a/lib/api/v1/assignment_group.rb
+++ b/lib/api/v1/assignment_group.rb
@@ -23,20 +23,20 @@ module Api::V1::AssignmentGroup
include Api::V1::Assignment
include Api::V1::Submission
- API_ALLOWED_ASSIGNMENT_GROUP_INPUT_FIELDS = %w(
+ API_ALLOWED_ASSIGNMENT_GROUP_INPUT_FIELDS = %w[
name
position
group_weight
rules
sis_source_id
integration_data
- ).freeze
+ ].freeze
def assignment_group_json(group, user, session, includes = [], opts = {})
includes ||= []
opts.reverse_merge!(override_assignment_dates: true, exclude_response_fields: [])
- hash = api_json(group, user, session, :only => %w(id name position group_weight sis_source_id integration_data))
+ hash = api_json(group, user, session, :only => %w[id name position group_weight sis_source_id integration_data])
hash['rules'] = group.rules_hash(stringify_json_ids: opts[:stringify_json_ids])
if includes.include?('assignments')
diff --git a/lib/api/v1/assignment_override.rb b/lib/api/v1/assignment_override.rb
index 000be1ee224..0942bef215d 100644
--- a/lib/api/v1/assignment_override.rb
+++ b/lib/api/v1/assignment_override.rb
@@ -192,7 +192,7 @@ module Api::V1::AssignmentOverride
errors << "one of student_ids, group_id, or course_section_id is required" if !set_type && errors.empty?
- if %w(ADHOC Noop).include?(set_type) && data.key?(:title)
+ if %w[ADHOC Noop].include?(set_type) && data.key?(:title)
override_data[:title] = data[:title]
end
diff --git a/lib/api/v1/attachment.rb b/lib/api/v1/attachment.rb
index 7f8d6205a60..0405265c0f5 100644
--- a/lib/api/v1/attachment.rb
+++ b/lib/api/v1/attachment.rb
@@ -247,7 +247,7 @@ module Api::V1::Attachment
end
def validate_on_duplicate(params)
- if params[:on_duplicate] && !%w(rename overwrite).include?(params[:on_duplicate])
+ if params[:on_duplicate] && !%w[rename overwrite].include?(params[:on_duplicate])
render status: :bad_request, json: {
message: 'invalid on_duplicate option'
}
diff --git a/lib/api/v1/calendar_event.rb b/lib/api/v1/calendar_event.rb
index 2d003877d0e..f0831e62d72 100644
--- a/lib/api/v1/calendar_event.rb
+++ b/lib/api/v1/calendar_event.rb
@@ -49,7 +49,7 @@ module Api::V1::CalendarEvent
event,
user,
session,
- :only => %w(id created_at updated_at start_at end_at all_day all_day_date title workflow_state comments)
+ :only => %w[id created_at updated_at start_at end_at all_day all_day_date title workflow_state comments]
)
if user
@@ -180,7 +180,7 @@ module Api::V1::CalendarEvent
def assignment_event_json(assignment, user, session, options = {})
excludes = options[:excludes] || []
- target_fields = %w(created_at updated_at title all_day all_day_date workflow_state)
+ target_fields = %w[created_at updated_at title all_day all_day_date workflow_state]
target_fields << 'description' unless excludes.include?('description')
hash = api_json(assignment, user, session, only: target_fields)
hash['description'] = api_user_content(hash['description'], assignment.context) unless excludes.include?('description')
@@ -218,7 +218,7 @@ module Api::V1::CalendarEvent
group,
user,
session,
- :only => %w{id created_at description end_at max_appointments_per_participant min_appointments_per_participant participants_per_appointment start_at title updated_at workflow_state participant_visibility}, :methods => :sub_context_codes
+ :only => %w[id created_at description end_at max_appointments_per_participant min_appointments_per_participant participants_per_appointment start_at title updated_at workflow_state participant_visibility], :methods => :sub_context_codes
)
if user
diff --git a/lib/api/v1/collaboration.rb b/lib/api/v1/collaboration.rb
index 59ca7ae6c17..cc6b5823aeb 100644
--- a/lib/api/v1/collaboration.rb
+++ b/lib/api/v1/collaboration.rb
@@ -22,7 +22,7 @@ module Api::V1::Collaboration
include Api::V1::Json
def collaboration_json(collaboration, current_user, session)
- attribute_whitelist = %w{id collaboration_type document_id user_id context_id context_type url created_at updated_at description title type update_url}
+ attribute_whitelist = %w[id collaboration_type document_id user_id context_id context_type url created_at updated_at description title type update_url]
api_json(collaboration, current_user, session, :only => attribute_whitelist).tap do |hash|
hash['user_name'] = collaboration.user[:name]
hash['update_url'] = collaboration.update_url
diff --git a/lib/api/v1/collaborator.rb b/lib/api/v1/collaborator.rb
index 23086ea462a..035d5766d81 100644
--- a/lib/api/v1/collaborator.rb
+++ b/lib/api/v1/collaborator.rb
@@ -23,7 +23,7 @@ module Api::V1::Collaborator
def collaborator_json(collaborator, current_user, session, options = {}, context: nil)
includes = options[:include] || []
- api_json(collaborator, current_user, session, :only => %w{id}).tap do |hash|
+ api_json(collaborator, current_user, session, :only => %w[id]).tap do |hash|
hash['type'] = collaborator.group_id.present? ? 'group' : 'user'
hash['name'] = collaborator.user.try(:sortable_name) ||
collaborator.group.try(:name)
diff --git a/lib/api/v1/communication_channel.rb b/lib/api/v1/communication_channel.rb
index 66a26b891ad..fb1a8ee8ce5 100644
--- a/lib/api/v1/communication_channel.rb
+++ b/lib/api/v1/communication_channel.rb
@@ -36,11 +36,11 @@ module Api::V1::CommunicationChannel
# :workflow_state
# :created_at
def communication_channel_json(channel, current_user, session)
- only = %w{id path_type position workflow_state user_id created_at}
+ only = %w[id path_type position workflow_state user_id created_at]
# Uses the method "path_description" instead of the field "path" because
# when path_type is twitter or yo, it goes and fetches tha user's account
# name with a fallback display value.
- methods = %w{path_description}
+ methods = %w[path_description]
# If the user is super special, show them this channel's bounce details
if channel.grants_right?(current_user, :read_bounce_details)
diff --git a/lib/api/v1/conferences.rb b/lib/api/v1/conferences.rb
index cd8445cec80..ebf5d17d270 100644
--- a/lib/api/v1/conferences.rb
+++ b/lib/api/v1/conferences.rb
@@ -20,12 +20,12 @@
module Api::V1::Conferences
API_CONFERENCE_JSON_OPTS = {
- :only => %w(
+ :only => %w[
id title conference_type description
duration ended_at started_at user_ids long_running
recordings join_url has_advanced_settings conference_key
context_type context_id
- ).freeze
+ ].freeze
}.freeze
def api_conferences_json(conferences, user, session)
diff --git a/lib/api/v1/content_export.rb b/lib/api/v1/content_export.rb
index cab6de48aab..fe2f99b7a3b 100644
--- a/lib/api/v1/content_export.rb
+++ b/lib/api/v1/content_export.rb
@@ -26,7 +26,7 @@ module Api::V1::ContentExport
include Api::V1::QuizzesNext::Quiz
def content_export_json(export, current_user, session, includes = [])
- json = api_json(export, current_user, session, :only => %w(id user_id created_at workflow_state export_type))
+ json = api_json(export, current_user, session, :only => %w[id user_id created_at workflow_state export_type])
json['course_id'] = export.context_id if export.context_type == 'Course'
if export.attachment && !export.for_course_copy? && !export.expired?
json[:attachment] = attachment_json(export.attachment, current_user, {}, { :can_view_hidden_files => true })
diff --git a/lib/api/v1/content_migration.rb b/lib/api/v1/content_migration.rb
index a8c7aa46c83..9ffb5f0702d 100644
--- a/lib/api/v1/content_migration.rb
+++ b/lib/api/v1/content_migration.rb
@@ -29,7 +29,7 @@ module Api::V1::ContentMigration
end
def content_migration_json(migration, current_user, session, attachment_preflight = nil, includes = [])
- json = api_json(migration, current_user, session, :only => %w(id user_id workflow_state started_at finished_at migration_type))
+ json = api_json(migration, current_user, session, :only => %w[id user_id workflow_state started_at finished_at migration_type])
json[:created_at] = migration.created_at
if json[:workflow_state] == 'created'
json[:workflow_state] = 'pre_processing'
@@ -97,7 +97,7 @@ module Api::V1::ContentMigration
end
def migration_issue_json(issue, migration, current_user, session)
- json = api_json(issue, current_user, session, :only => %w(id description workflow_state fix_issue_html_url issue_type created_at updated_at))
+ json = api_json(issue, current_user, session, :only => %w[id description workflow_state fix_issue_html_url issue_type created_at updated_at])
json[:content_migration_url] = api_v1_course_content_migration_url(migration.context_id, issue.content_migration_id)
if issue.grants_right?(current_user, :read_errors)
json[:error_message] = issue.error_message
diff --git a/lib/api/v1/content_share.rb b/lib/api/v1/content_share.rb
index 7bb07830f6c..d9ab2476f2c 100644
--- a/lib/api/v1/content_share.rb
+++ b/lib/api/v1/content_share.rb
@@ -33,7 +33,7 @@ module Api::V1::ContentShare
}.freeze
def content_share_json(content_share, user, session, opts = {})
- json = api_json(content_share, user, session, opts.merge(only: %w(id name created_at updated_at user_id read_state)))
+ json = api_json(content_share, user, session, opts.merge(only: %w[id name created_at updated_at user_id read_state]))
json['sender'] = content_share.respond_to?(:sender) && content_share.sender ? user_display_json(content_share.sender) : nil
json['receivers'] = content_share.respond_to?(:receivers) ? content_share.receivers.map { |rec| user_display_json(rec) } : []
if content_share.content_export
@@ -82,7 +82,7 @@ module Api::V1::ContentShare
return nil unless settings.key?('selected_content')
selected_types = settings['selected_content'].keys.filter_map { |k| EXPORT_TYPES[k] }
- %w(module module_item).each { |k| return k if selected_types.include?(k) }
+ %w[module module_item].each { |k| return k if selected_types.include?(k) }
# otherwise there should be only one selected type...
selected_types.first
end
diff --git a/lib/api/v1/context_module.rb b/lib/api/v1/context_module.rb
index 74753d7973f..19a5203de10 100644
--- a/lib/api/v1/context_module.rb
+++ b/lib/api/v1/context_module.rb
@@ -26,9 +26,9 @@ module Api::V1::ContextModule
include Api::V1::Locked
include Api::V1::Assignment
- MODULE_JSON_ATTRS = %w(id position name unlock_at).freeze
+ MODULE_JSON_ATTRS = %w[id position name unlock_at].freeze
- MODULE_ITEM_JSON_ATTRS = %w(id position title indent).freeze
+ MODULE_ITEM_JSON_ATTRS = %w[id position title indent].freeze
ITEM_TYPE = {
Assignment: 'assignment',
@@ -97,7 +97,7 @@ module Api::V1::ContextModule
# add content_id, if applicable
# (note that wiki page ids are not exposed by the api)
- unless %w(WikiPage ContextModuleSubHeader ExternalUrl).include? content_tag.content_type
+ unless %w[WikiPage ContextModuleSubHeader ExternalUrl].include? content_tag.content_type
hash['content_id'] = content_tag.content_id
end
diff --git a/lib/api/v1/conversation.rb b/lib/api/v1/conversation.rb
index 2036d85b1c7..129a5f47223 100644
--- a/lib/api/v1/conversation.rb
+++ b/lib/api/v1/conversation.rb
@@ -146,8 +146,8 @@ module Api::V1::Conversation
result = api_json batch,
current_user,
session,
- :only => %w{id workflow_state},
- :methods => %w{completion recipient_count}
+ :only => %w[id workflow_state],
+ :methods => %w[completion recipient_count]
result[:message] = conversation_message_json(batch.root_conversation_message, current_user, session)
result[:tags] = batch.local_tags
result
diff --git a/lib/api/v1/course.rb b/lib/api/v1/course.rb
index 25cb0460ac3..264372503aa 100644
--- a/lib/api/v1/course.rb
+++ b/lib/api/v1/course.rb
@@ -106,7 +106,7 @@ module Api::V1::Course
hash['term'] = enrollment_term_json(course.enrollment_term, user, session, enrollments, []) if includes.include?('term')
if includes.include?('grading_periods')
hash['grading_periods'] = course.enrollment_term&.grading_period_group&.grading_periods&.map do |gp|
- api_json(gp, user, session, :only => %w(id title start_date end_date workflow_state))
+ api_json(gp, user, session, :only => %w[id title start_date end_date workflow_state])
end
end
if includes.include?('course_progress')
@@ -119,7 +119,7 @@ module Api::V1::Course
hash['sections'] = if enrollments.any?
section_enrollments_json(enrollments)
else
- course.course_sections.map { |section| section.attributes.slice(*%w(id name start_at end_at)) }
+ course.course_sections.map { |section| section.attributes.slice(*%w[id name start_at end_at]) }
end
end
hash['total_students'] = course.student_count || course.student_enrollments.not_fake.distinct.count(:user_id) if includes.include?('total_students')
@@ -165,7 +165,7 @@ module Api::V1::Course
end
def copy_status_json(import, course, user, session)
- hash = api_json(import, user, session, :only => %w(id progress created_at workflow_state integration_id))
+ hash = api_json(import, user, session, :only => %w[id progress created_at workflow_state integration_id])
# the type of object for course copy changed but we don't want the api to change
# so map the workflow states to the old ones
@@ -215,7 +215,7 @@ module Api::V1::Course
def preload_teachers(courses)
threshold = params[:teacher_limit].presence&.to_i
if threshold
- scope = TeacherEnrollment.where.not(:workflow_state => %w{deleted rejected}).where(:course_id => courses).distinct.select(:user_id, :course_id)
+ scope = TeacherEnrollment.where.not(:workflow_state => %w[deleted rejected]).where(:course_id => courses).distinct.select(:user_id, :course_id)
teacher_counts = Enrollment.from("(#{scope.to_sql}) AS t").group("t.course_id").count
to_preload = []
courses.each do |course|
diff --git a/lib/api/v1/course_json.rb b/lib/api/v1/course_json.rb
index f88a4f2322b..7c0b7d72af1 100644
--- a/lib/api/v1/course_json.rb
+++ b/lib/api/v1/course_json.rb
@@ -19,13 +19,13 @@
module Api::V1
class CourseJson
- BASE_ATTRIBUTES = %w(id name course_code account_id created_at start_at default_view enrollment_term_id is_public
- grading_standard_id root_account_id uuid license grade_passback_setting).freeze
+ BASE_ATTRIBUTES = %w[id name course_code account_id created_at start_at default_view enrollment_term_id is_public
+ grading_standard_id root_account_id uuid license grade_passback_setting].freeze
INCLUDE_CHECKERS = { grading: 'needs_grading_count', syllabus: 'syllabus_body',
url: 'html_url', description: 'public_description', permissions: 'permissions' }.freeze
- OPTIONAL_FIELDS = %w(needs_grading_count public_description enrollments).freeze
+ OPTIONAL_FIELDS = %w[needs_grading_count public_description enrollments].freeze
attr_reader :course, :user, :includes, :enrollments, :hash
diff --git a/lib/api/v1/custom_gradebook_column.rb b/lib/api/v1/custom_gradebook_column.rb
index 3fc886c1d5b..eff596034f4 100644
--- a/lib/api/v1/custom_gradebook_column.rb
+++ b/lib/api/v1/custom_gradebook_column.rb
@@ -22,13 +22,13 @@ module Api::V1::CustomGradebookColumn
include Api::V1::Json
def custom_gradebook_column_json(column, user, session)
- json = api_json column, user, session, :only => %w(id title position
- teacher_notes read_only)
+ json = api_json column, user, session, :only => %w[id title position
+ teacher_notes read_only]
json[:hidden] = column.hidden?
json
end
def custom_gradebook_column_datum_json(datum, user, session)
- api_json datum, user, session, :only => %w(user_id content)
+ api_json datum, user, session, :only => %w[user_id content]
end
end
diff --git a/lib/api/v1/developer_key.rb b/lib/api/v1/developer_key.rb
index 1541813208a..1dc726dc5aa 100644
--- a/lib/api/v1/developer_key.rb
+++ b/lib/api/v1/developer_key.rb
@@ -21,9 +21,9 @@
module Api::V1::DeveloperKey
include Api::V1::Json
- DEVELOPER_KEY_JSON_ATTRS = %w(
+ DEVELOPER_KEY_JSON_ATTRS = %w[
name created_at email user_id user_name icon_url notes workflow_state scopes require_scopes client_credentials_audience
- ).freeze
+ ].freeze
INHERITED_DEVELOPER_KEY_JSON_ATTRS = %w[name created_at icon_url workflow_state].freeze
def developer_keys_json(keys, user, session, context, inherited: false, include_tool_config: false)
diff --git a/lib/api/v1/discussion_topics.rb b/lib/api/v1/discussion_topics.rb
index ff4f7beca69..fb38e319a08 100644
--- a/lib/api/v1/discussion_topics.rb
+++ b/lib/api/v1/discussion_topics.rb
@@ -29,12 +29,12 @@ module Api::V1::DiscussionTopics
include HtmlTextHelper
# Public: DiscussionTopic fields to serialize.
- ALLOWED_TOPIC_FIELDS = %w{
+ ALLOWED_TOPIC_FIELDS = %w[
id title assignment_id delayed_post_at lock_at created_at
last_reply_at posted_at root_topic_id podcast_has_student_posts
discussion_type position allow_rating only_graders_can_rate sort_by_rating
is_section_specific
- }.freeze
+ ].freeze
# Public: DiscussionTopic methods to serialize.
ALLOWED_TOPIC_METHODS = [:user_name, :discussion_subentry_count].freeze
@@ -240,7 +240,7 @@ module Api::V1::DiscussionTopics
#
# Returns a hash.
def serialize_entry(entry, user, context, session, includes)
- allowed_fields = %w{id created_at updated_at parent_id rating_count rating_sum}
+ allowed_fields = %w[id created_at updated_at parent_id rating_count rating_sum]
allowed_methods = []
allowed_fields << 'editor_id' if entry.deleted? || entry.editor_id
allowed_fields << 'user_id' unless entry.deleted?
diff --git a/lib/api/v1/enrollment_term.rb b/lib/api/v1/enrollment_term.rb
index 6ea2c89c2b8..11582201d2a 100644
--- a/lib/api/v1/enrollment_term.rb
+++ b/lib/api/v1/enrollment_term.rb
@@ -21,7 +21,7 @@ module Api::V1::EnrollmentTerm
include Api::V1::Json
def enrollment_term_json(enrollment_term, user, session, enrollments = [], includes = [])
- api_json(enrollment_term, user, session, :only => %w(id name start_at end_at workflow_state grading_period_group_id created_at)).tap do |hash|
+ api_json(enrollment_term, user, session, :only => %w[id name start_at end_at workflow_state grading_period_group_id created_at]).tap do |hash|
hash['sis_term_id'] = enrollment_term.sis_source_id if enrollment_term.root_account.grants_any_right?(user, :read_sis, :manage_sis)
if enrollment_term.root_account.grants_right?(user, :manage_sis)
hash['sis_import_id'] = enrollment_term.sis_batch_id
diff --git a/lib/api/v1/eportfolio.rb b/lib/api/v1/eportfolio.rb
index 1602c2f96e7..18e026724d1 100644
--- a/lib/api/v1/eportfolio.rb
+++ b/lib/api/v1/eportfolio.rb
@@ -20,8 +20,8 @@
module Api::V1::Eportfolio
include Api::V1::Json
- EPORTFOLIO_ATTRIBUTES = %w(id user_id name public created_at updated_at workflow_state deleted_at spam_status).freeze
- ENTRY_ATTRIBUTES = %w(id eportfolio_id position name content created_at updated_at).freeze
+ EPORTFOLIO_ATTRIBUTES = %w[id user_id name public created_at updated_at workflow_state deleted_at spam_status].freeze
+ ENTRY_ATTRIBUTES = %w[id eportfolio_id position name content created_at updated_at].freeze
def eportfolio_json(eportfolio, current_user, session)
api_json(eportfolio, current_user, session, only: EPORTFOLIO_ATTRIBUTES).tap do |hash|
diff --git a/lib/api/v1/external_feeds.rb b/lib/api/v1/external_feeds.rb
index d07eac7d25a..d2395cd00e0 100644
--- a/lib/api/v1/external_feeds.rb
+++ b/lib/api/v1/external_feeds.rb
@@ -21,8 +21,8 @@
module Api::V1::ExternalFeeds
include Api::V1::Json
- API_ALLOWED_EXTERNAL_FEED_PARAMS = %w{url header_match verbosity}.freeze
- API_EXPOSED_EXTERNAL_FEED_PARAMS = %w(id url header_match created_at verbosity).freeze
+ API_ALLOWED_EXTERNAL_FEED_PARAMS = %w[url header_match verbosity].freeze
+ API_EXPOSED_EXTERNAL_FEED_PARAMS = %w[id url header_match created_at verbosity].freeze
def external_feeds_api_json(external_feeds, context, user, session)
external_feeds.map do |external_feed|
diff --git a/lib/api/v1/external_tools.rb b/lib/api/v1/external_tools.rb
index a0036da827c..c69bbc0bc56 100644
--- a/lib/api/v1/external_tools.rb
+++ b/lib/api/v1/external_tools.rb
@@ -30,7 +30,7 @@ module Api::V1::ExternalTools
def external_tool_json(tool, context, user, session, extension_types = Lti::ResourcePlacement.valid_placements(@domain_root_account))
methods = %w[privacy_level custom_fields workflow_state vendor_help_link]
methods += extension_types
- only = %w(id name description url domain consumer_key created_at updated_at description)
+ only = %w[id name description url domain consumer_key created_at updated_at description]
only << 'allow_membership_service_access' if tool.context.root_account.feature_enabled?(:membership_service_for_lti_tools)
json = api_json(tool, user, session,
:only => only,
diff --git a/lib/api/v1/favorite.rb b/lib/api/v1/favorite.rb
index ffaec7289b6..2830b36c735 100644
--- a/lib/api/v1/favorite.rb
+++ b/lib/api/v1/favorite.rb
@@ -23,6 +23,6 @@ module Api::V1::Favorite
include Api::V1::User
def favorite_json(favorite, current_user, session)
- api_json(favorite, current_user, session, :only => %w(context_id context_type))
+ api_json(favorite, current_user, session, :only => %w[context_id context_type])
end
end
diff --git a/lib/api/v1/feature_flag.rb b/lib/api/v1/feature_flag.rb
index 519ff0552f1..585f682c190 100644
--- a/lib/api/v1/feature_flag.rb
+++ b/lib/api/v1/feature_flag.rb
@@ -41,7 +41,7 @@ module Api::V1::FeatureFlag
hash = if feature_flag.default?
feature_flag.as_json.slice('feature', 'state')
else
- keys = %w(feature context_id context_type state)
+ keys = %w[feature context_id context_type state]
api_json(feature_flag, current_user, session, only: keys)
end
hash['locking_account_id'] = nil unless feature_flag.default?
diff --git a/lib/api/v1/folders.rb b/lib/api/v1/folders.rb
index 14b7dcd6dc5..05baa6659ad 100644
--- a/lib/api/v1/folders.rb
+++ b/lib/api/v1/folders.rb
@@ -30,7 +30,7 @@ module Api::V1::Folders
def folder_json(folder, user, session, opts = {})
can_view_hidden_files = opts.key?(:can_view_hidden_files) ? opts[:can_view_hidden_files] : folder.grants_right?(user, :update)
json = api_json(folder, user, session,
- :only => %w(id name full_name position parent_folder_id context_type context_id unlock_at lock_at created_at updated_at))
+ :only => %w[id name full_name position parent_folder_id context_type context_id unlock_at lock_at created_at updated_at])
if folder
if opts[:master_course_restricted_folder_ids]&.include?(folder.id)
json['is_master_course_child_content'] = true
diff --git a/lib/api/v1/grading_standard.rb b/lib/api/v1/grading_standard.rb
index 2fae250be02..6b918b4c12f 100644
--- a/lib/api/v1/grading_standard.rb
+++ b/lib/api/v1/grading_standard.rb
@@ -21,7 +21,7 @@ module Api::V1::GradingStandard
include Api::V1::Json
def grading_standard_json(grading_standard, user, session)
- api_json(grading_standard, user, session, :only => %w(id title context_type context_id)).tap do |hash|
+ api_json(grading_standard, user, session, :only => %w[id title context_type context_id]).tap do |hash|
hash[:grading_scheme] = grading_standard['data'].map { |a| { name: a[0], value: a[1] } }
end
end
diff --git a/lib/api/v1/group.rb b/lib/api/v1/group.rb
index 4dae2044580..ccbce9594b2 100644
--- a/lib/api/v1/group.rb
+++ b/lib/api/v1/group.rb
@@ -24,12 +24,12 @@ module Api::V1::Group
include Api::V1::Tab
API_GROUP_JSON_OPTS = {
- :only => %w(id name description is_public join_level group_category_id max_membership created_at),
- :methods => %w(members_count storage_quota_mb),
+ :only => %w[id name description is_public join_level group_category_id max_membership created_at],
+ :methods => %w[members_count storage_quota_mb],
}.freeze
API_GROUP_MEMBERSHIP_JSON_OPTS = {
- :only => %w(id group_id user_id workflow_state moderator created_at).freeze
+ :only => %w[id group_id user_id workflow_state moderator created_at].freeze
}.freeze
# permission keys need to be symbols
diff --git a/lib/api/v1/group_category.rb b/lib/api/v1/group_category.rb
index 01b03e3cdbb..9c92f5c2a5a 100644
--- a/lib/api/v1/group_category.rb
+++ b/lib/api/v1/group_category.rb
@@ -25,7 +25,7 @@ module Api::V1::GroupCategory
include Api::V1::Group
API_GROUP_CATEGORY_JSON_OPTS = {
- :only => %w(id name role self_signup group_limit auto_leader created_at)
+ :only => %w[id name role self_signup group_limit auto_leader created_at]
}.freeze
def group_category_json(group_category, user, session, options = {})
diff --git a/lib/api/v1/history_entry.rb b/lib/api/v1/history_entry.rb
index 4bdd14321aa..38126ed4e0f 100644
--- a/lib/api/v1/history_entry.rb
+++ b/lib/api/v1/history_entry.rb
@@ -22,7 +22,7 @@ module Api::V1::HistoryEntry
include Api::V1::Json
def history_entry_json(page_view, asset_user_access, user, session)
- entry = api_json(asset_user_access, user, session, only: %w(asset_code context_type context_id))
+ entry = api_json(asset_user_access, user, session, only: %w[asset_code context_type context_id])
entry['visited_at'] = page_view.created_at
if asset_user_access.category == 'files' && page_view.url.include?('verifier')
strip_verifier = Addressable::URI.parse(page_view.url)
diff --git a/lib/api/v1/master_courses.rb b/lib/api/v1/master_courses.rb
index a3e6309e910..5419064198f 100644
--- a/lib/api/v1/master_courses.rb
+++ b/lib/api/v1/master_courses.rb
@@ -21,7 +21,7 @@ module Api::V1::MasterCourses
include Api::V1::User
def master_template_json(template, user, session, **)
- hash = api_json(template, user, session, :only => %w(id course_id), :methods => %w{last_export_completed_at associated_course_count})
+ hash = api_json(template, user, session, :only => %w[id course_id], :methods => %w[last_export_completed_at associated_course_count])
migration = template.active_migration
hash[:latest_migration] = master_migration_json(migration, user, session) if migration
hash
@@ -30,7 +30,7 @@ module Api::V1::MasterCourses
def master_migration_json(migration, user, session, opts = {})
migration.expire_if_necessary!
hash = api_json(migration, user, session,
- :only => %w(id user_id workflow_state created_at exports_started_at imports_queued_at imports_completed_at comment))
+ :only => %w[id user_id workflow_state created_at exports_started_at imports_queued_at imports_completed_at comment])
if opts[:subscription]
hash['subscription_id'] = opts[:subscription].id
else
@@ -101,7 +101,7 @@ module Api::V1::MasterCourses
def course_summary_json(course, opts = {})
can_read_sis = opts[:can_read_sis] || course.account.grants_any_right?(@current_user, :read_sis, :manage_sis)
- hash = api_json(course, @current_user, session, :only => %w{id name course_code})
+ hash = api_json(course, @current_user, session, :only => %w[id name course_code])
hash['sis_course_id'] = course.sis_source_id if can_read_sis
hash['term_name'] = course.enrollment_term.name
if opts[:include_teachers]
diff --git a/lib/api/v1/media_object.rb b/lib/api/v1/media_object.rb
index 628cc358239..9f792b7df7a 100644
--- a/lib/api/v1/media_object.rb
+++ b/lib/api/v1/media_object.rb
@@ -19,7 +19,7 @@
#
API_MEDIA_OBJECT_JSON_OPTS = {
- :only => %w(media_id created_at media_type).freeze,
+ :only => %w[media_id created_at media_type].freeze,
}.freeze
module Api::V1::MediaObject
@@ -32,7 +32,7 @@ module Api::V1::MediaObject
unless exclude.include?('tracks')
json['media_tracks'] = media_object.media_tracks.map do |track|
- api_json(track, current_user, session, :only => %w(kind created_at updated_at id locale)).tap do |json2|
+ api_json(track, current_user, session, :only => %w[kind created_at updated_at id locale]).tap do |json2|
json2[:url] = show_media_tracks_url(media_object.media_id, track.id)
end
end
diff --git a/lib/api/v1/moderation_grader.rb b/lib/api/v1/moderation_grader.rb
index 0bf8258b24b..130413182a9 100644
--- a/lib/api/v1/moderation_grader.rb
+++ b/lib/api/v1/moderation_grader.rb
@@ -30,7 +30,7 @@ module Api::V1::ModerationGrader
graders = provisional_graders.preload(:user)
graders_by_id = graders.index_by(&:id)
- api_json(graders, user, session, only: %w(id user_id)).tap do |hash|
+ api_json(graders, user, session, only: %w[id user_id]).tap do |hash|
hash.each do |grader_json|
grader_json['grader_name'] = graders_by_id[grader_json['id']].user.short_name
grader_json['grader_selectable'] = active_user_ids.include?(grader_json['user_id'])
@@ -38,7 +38,7 @@ module Api::V1::ModerationGrader
end
else
active_user_ids.map! { |id| assignment.grader_ids_to_anonymous_ids[id.to_s] }
- api_json(provisional_graders, user, session, only: %w(id anonymous_id))
+ api_json(provisional_graders, user, session, only: %w[id anonymous_id])
.each { |grader_json| grader_json['grader_selectable'] = active_user_ids.include?(grader_json['anonymous_id']) }
end
end
diff --git a/lib/api/v1/notification_policy.rb b/lib/api/v1/notification_policy.rb
index f7906cab6d2..e242431bc27 100644
--- a/lib/api/v1/notification_policy.rb
+++ b/lib/api/v1/notification_policy.rb
@@ -23,7 +23,7 @@ module Api::V1::NotificationPolicy
include Api::V1::Json
JSON_OPTS = {
- :only => %w{frequency}
+ :only => %w[frequency]
}.freeze
def notification_policy_json(policy, user, session)
diff --git a/lib/api/v1/observer_alert.rb b/lib/api/v1/observer_alert.rb
index ffa19b98feb..65877af7b9d 100644
--- a/lib/api/v1/observer_alert.rb
+++ b/lib/api/v1/observer_alert.rb
@@ -23,7 +23,7 @@ module Api::V1::ObserverAlert
include ApplicationHelper
API_ALLOWED_OUTPUT_FIELDS = {
- :only => %w(
+ :only => %w[
id
title
user_id
@@ -34,7 +34,7 @@ module Api::V1::ObserverAlert
context_id
workflow_state
action_date
- ).freeze
+ ].freeze
}.freeze
def observer_alert_json(alert, user, session, _opts = {})
diff --git a/lib/api/v1/observer_alert_threshold.rb b/lib/api/v1/observer_alert_threshold.rb
index 6e17fe9bdd0..6394631df5f 100644
--- a/lib/api/v1/observer_alert_threshold.rb
+++ b/lib/api/v1/observer_alert_threshold.rb
@@ -23,14 +23,14 @@ module Api::V1::ObserverAlertThreshold
include ApplicationHelper
API_ALLOWED_OUTPUT_FIELDS = {
- :only => %w(
+ :only => %w[
id
user_id
observer_id
alert_type
threshold
workflow_state
- ).freeze
+ ].freeze
}.freeze
def observer_alert_threshold_json(threshold, user, session, _opts = {})
diff --git a/lib/api/v1/outcome.rb b/lib/api/v1/outcome.rb
index 5173b52c02b..c851d3d2d3e 100644
--- a/lib/api/v1/outcome.rb
+++ b/lib/api/v1/outcome.rb
@@ -63,7 +63,7 @@ module Api::V1::Outcome
Account.site_admin.grants_right?(user, session, :manage_global_outcomes)
end
- json_attributes = %w(id context_type context_id vendor_guid display_name)
+ json_attributes = %w[id context_type context_id vendor_guid display_name]
api_json(outcome, user, session, :only => json_attributes, :methods => [:title]).tap do |hash|
hash['url'] = api_v1_outcome_path :id => outcome.id
hash['can_edit'] = can_edit.call
@@ -103,7 +103,7 @@ module Api::V1::Outcome
# context id and type, and description.
def outcome_group_json(outcome_group, user, session, style = :full)
path_context = outcome_group.context || :global
- api_json(outcome_group, user, session, :only => %w(id title vendor_guid)).tap do |hash|
+ api_json(outcome_group, user, session, :only => %w[id title vendor_guid]).tap do |hash|
hash['url'] = polymorphic_path [:api_v1, path_context, :outcome_group], :id => outcome_group.id
hash['subgroups_url'] = polymorphic_path [:api_v1, path_context, :outcome_group_subgroups], :id => outcome_group.id
hash['outcomes_url'] = polymorphic_path [:api_v1, path_context, :outcome_group_outcomes], :id => outcome_group.id
@@ -141,7 +141,7 @@ module Api::V1::Outcome
def outcome_link_json(outcome_link, user, session, opts = {})
opts[:outcome_style] ||= :abbrev
opts[:outcome_group_style] ||= :abbrev
- api_json(outcome_link, user, session, :only => %w(context_type context_id)).tap do |hash|
+ api_json(outcome_link, user, session, :only => %w[context_type context_id]).tap do |hash|
hash['url'] = polymorphic_path [:api_v1, outcome_link.context || :global, :outcome_link],
:id => outcome_link.associated_asset_id,
:outcome_id => outcome_link.content_id
diff --git a/lib/api/v1/outcome_results.rb b/lib/api/v1/outcome_results.rb
index dbea495fbb2..ae6fc477ba5 100644
--- a/lib/api/v1/outcome_results.rb
+++ b/lib/api/v1/outcome_results.rb
@@ -38,7 +38,7 @@ module Api::V1::OutcomeResults
def outcome_result_json(result)
hash = api_json(result, @current_user, session, {
methods: :submitted_or_assessed_at,
- only: %w(id score mastery possible percent hide_points hidden)
+ only: %w[id score mastery possible percent hide_points hidden]
})
hash[:links] = {
user: result.user.id.to_s,
diff --git a/lib/api/v1/planner_note.rb b/lib/api/v1/planner_note.rb
index 0aba0ff0158..fe4824242d5 100644
--- a/lib/api/v1/planner_note.rb
+++ b/lib/api/v1/planner_note.rb
@@ -29,7 +29,7 @@ module Api::V1::PlannerNote
}.freeze
API_JSON_OPTS = {
- :only => %w(id todo_date title details user_id course_id workflow_state created_at updated_at)
+ :only => %w[id todo_date title details user_id course_id workflow_state created_at updated_at]
}.freeze
def planner_note_json(note, user, session, opts = {})
diff --git a/lib/api/v1/post_grades_status.rb b/lib/api/v1/post_grades_status.rb
index eaa5a35ff3b..c7a228ff5ef 100644
--- a/lib/api/v1/post_grades_status.rb
+++ b/lib/api/v1/post_grades_status.rb
@@ -22,6 +22,6 @@ module Api::V1::PostGradesStatus
include Api::V1::Json
def post_grades_status_json(course_or_section)
- course_or_section.sis_post_grades_statuses.last.as_json(:only => %w(id course_id course_section_id status message grades_posted_at))
+ course_or_section.sis_post_grades_statuses.last.as_json(:only => %w[id course_id course_section_id status message grades_posted_at])
end
end
diff --git a/lib/api/v1/progress.rb b/lib/api/v1/progress.rb
index 9da9e33fcac..7602425cf2f 100644
--- a/lib/api/v1/progress.rb
+++ b/lib/api/v1/progress.rb
@@ -22,7 +22,7 @@ module Api::V1::Progress
include Api::V1::Json
def progress_json(progress, current_user, session, **)
- api_json(progress, current_user, session, :only => %w(id context_id context_type user_id tag completion workflow_state created_at updated_at message)).tap do |hash|
+ api_json(progress, current_user, session, :only => %w[id context_id context_type user_id tag completion workflow_state created_at updated_at message]).tap do |hash|
hash['url'] = polymorphic_url([:api_v1, progress])
unless progress.pending? || progress.results.nil?
hash['results'] = progress.results
diff --git a/lib/api/v1/quiz.rb b/lib/api/v1/quiz.rb
index c58ec69f84f..fc165468b10 100644
--- a/lib/api/v1/quiz.rb
+++ b/lib/api/v1/quiz.rb
@@ -21,7 +21,7 @@ module Api::V1::Quiz
include Api::V1::Json
API_ALLOWED_QUIZ_INPUT_FIELDS = {
- :only => (%w(
+ :only => (%w[
access_code
allowed_attempts
anonymous_submissions
@@ -52,7 +52,7 @@ module Api::V1::Quiz
disable_timer_autosubmission
title
unlock_at
- ) + [{ 'hide_results' => ArbitraryStrongishParams::ANYTHING }] # because sometimes this is a hash :/
+ ] + [{ 'hide_results' => ArbitraryStrongishParams::ANYTHING }] # because sometimes this is a hash :/
).freeze
}.freeze
diff --git a/lib/api/v1/quiz_group.rb b/lib/api/v1/quiz_group.rb
index 40bedffa177..11ddc05c5cf 100644
--- a/lib/api/v1/quiz_group.rb
+++ b/lib/api/v1/quiz_group.rb
@@ -22,7 +22,7 @@ module Api::V1::QuizGroup
include Api::V1::Json
API_ALLOWED_QUIZ_GROUP_OUTPUT_FIELDS = {
- :only => %w(
+ :only => %w[
id
quiz_id
name
@@ -30,17 +30,17 @@ module Api::V1::QuizGroup
question_points
assessment_question_bank_id
position
- )
+ ]
}.freeze
API_ALLOWED_QUIZ_INPUT_FIELDS = {
- :only => %w(
+ :only => %w[
name
pick_count
question_points
assessment_question_bank_id
position
- )
+ ]
}.freeze
def quiz_groups_compound_json(quiz_groups, context, user, session)
diff --git a/lib/api/v1/quiz_question.rb b/lib/api/v1/quiz_question.rb
index 8ba51b0bd49..9c9c8fa0941 100644
--- a/lib/api/v1/quiz_question.rb
+++ b/lib/api/v1/quiz_question.rb
@@ -22,17 +22,17 @@ module Api::V1::QuizQuestion
include Api::V1::Json
API_ALLOWED_QUESTION_OUTPUT_FIELDS = {
- :only => %w(
+ :only => %w[
id
quiz_id
position
regrade_option
assessment_question_id
quiz_group_id
- )
+ ]
}.freeze
- API_ALLOWED_QUESTION_DATA_OUTPUT_FIELDS = %w(
+ API_ALLOWED_QUESTION_DATA_OUTPUT_FIELDS = %w[
question_name
question_type
question_text
@@ -51,7 +51,7 @@ module Api::V1::QuizQuestion
formula_decimal_places
matches
matching_answer_incorrect_matches
- ).freeze
+ ].freeze
# @param [Quizzes::Quiz#quiz_data] quiz_data
# If you specify a quiz_data construct from a submission (or a quiz), then
@@ -122,22 +122,22 @@ module Api::V1::QuizQuestion
question_data = question_data.with_indifferent_access
# whitelist question details for students
- attr_whitelist = %w(
+ attr_whitelist = %w[
id position quiz_group_id quiz_id assessment_question_id
assessment_question question_name question_type question_text answers matches
formulas variables answer_tolerance formula_decimal_places
- )
+ ]
question_data.keep_if { |k, _v| attr_whitelist.include?(k.to_s) }
# only include answers for types that need it to show choices
- allow_answer_whitelist = %w(
+ allow_answer_whitelist = %w[
multiple_choice_question
true_false_question
multiple_answers_question
matching_question
multiple_dropdowns_question
calculated_question
- )
+ ]
unless allow_answer_whitelist.include?(question_data[:question_type])
question_data.delete(:answers)
@@ -147,7 +147,7 @@ module Api::V1::QuizQuestion
# multiple_dropdown needs blank_id
# formula questions need variables
question_data[:answers]&.each do |record|
- record.keep_if { |k, _| %w(id text html blank_id variables).include?(k.to_s) }
+ record.keep_if { |k, _| %w[id text html blank_id variables].include?(k.to_s) }
end
question_data
diff --git a/lib/api/v1/rubric.rb b/lib/api/v1/rubric.rb
index c8ed645e4b2..6efc883781b 100644
--- a/lib/api/v1/rubric.rb
+++ b/lib/api/v1/rubric.rb
@@ -24,7 +24,7 @@ module Api::V1::Rubric
include Api::V1::RubricAssociation
API_ALLOWED_RUBRIC_OUTPUT_FIELDS = {
- only: %w(
+ only: %w[
id
title
context_id
@@ -36,7 +36,7 @@ module Api::V1::Rubric
free_form_criterion_comments
hide_score_total
data
- )
+ ]
}.freeze
def rubrics_json(rubrics, user, session, opts = {})
diff --git a/lib/api/v1/rubric_assessment.rb b/lib/api/v1/rubric_assessment.rb
index ea1b572b8e9..9fe30f94dcc 100644
--- a/lib/api/v1/rubric_assessment.rb
+++ b/lib/api/v1/rubric_assessment.rb
@@ -22,7 +22,7 @@ module Api::V1::RubricAssessment
include Api::V1::Json
API_ALLOWED_RUBRIC_ASSESSMENT_OUTPUT_FIELDS = {
- only: %w(
+ only: %w[
id
rubric_id
rubric_association_id
@@ -32,7 +32,7 @@ module Api::V1::RubricAssessment
artifact_attempt
assessment_type
assessor_id
- )
+ ]
}.freeze
def rubric_assessments_json(rubric_assessments, user, session, opts = {})
diff --git a/lib/api/v1/rubric_association.rb b/lib/api/v1/rubric_association.rb
index 908f72e2f27..d5eb3900f28 100644
--- a/lib/api/v1/rubric_association.rb
+++ b/lib/api/v1/rubric_association.rb
@@ -22,7 +22,7 @@ module Api::V1::RubricAssociation
include Api::V1::Json
API_ALLOWED_RUBRIC_ASSOCIATION_OUTPUT_FIELDS = {
- only: %w(
+ only: %w[
id
rubric_id
association_type
@@ -33,7 +33,7 @@ module Api::V1::RubricAssociation
hide_score_total
hide_points
hide_outcome_results
- )
+ ]
}.freeze
def rubric_associations_json(rubric_associations, user, session, opts = {})
diff --git a/lib/api/v1/section.rb b/lib/api/v1/section.rb
index 8771a6e2a67..89f367ead3d 100644
--- a/lib/api/v1/section.rb
+++ b/lib/api/v1/section.rb
@@ -24,7 +24,7 @@ module Api::V1::Section
def section_json(section, user, session, includes, options = {})
res = section.as_json(:include_root => false,
- :only => %w(id name course_id nonxlist_course_id start_at end_at restrict_enrollments_to_section_dates created_at))
+ :only => %w[id name course_id nonxlist_course_id start_at end_at restrict_enrollments_to_section_dates created_at])
if options[:allow_sis_ids] || section.course.grants_any_right?(user, :read_sis, :manage_sis)
res['sis_section_id'] = section.sis_source_id
res['sis_course_id'] = section.course.sis_source_id
diff --git a/lib/api/v1/section_enrollments.rb b/lib/api/v1/section_enrollments.rb
index 727150e5751..0c912b6d554 100644
--- a/lib/api/v1/section_enrollments.rb
+++ b/lib/api/v1/section_enrollments.rb
@@ -22,7 +22,7 @@ module Api::V1::SectionEnrollments
def section_enrollments_json(enrollments)
enrollments.map do |enrollment|
section = enrollment.course_section
- section_json = section.attributes.slice(*%w(id name start_at end_at))
+ section_json = section.attributes.slice(*%w[id name start_at end_at])
section_json[:enrollment_role] = enrollment.type
section_json
end
diff --git a/lib/api/v1/sis_assignment.rb b/lib/api/v1/sis_assignment.rb
index d4cab08be01..70034b0e37f 100644
--- a/lib/api/v1/sis_assignment.rb
+++ b/lib/api/v1/sis_assignment.rb
@@ -25,28 +25,28 @@ module Api::V1::SisAssignment
end
API_SIS_ASSIGNMENT_JSON_OPTS = {
- only: %i(id created_at due_at unlock_at lock_at points_possible sis_assignment_id integration_id integration_data include_in_final_grade).freeze,
- methods: %i(name submission_types_array).freeze
+ only: %i[id created_at due_at unlock_at lock_at points_possible sis_assignment_id integration_id integration_data include_in_final_grade].freeze,
+ methods: %i[name submission_types_array].freeze
}.freeze
API_SIS_ASSIGNMENT_GROUP_JSON_OPTS = {
- only: %i(id name sis_source_id integration_data group_weight).freeze
+ only: %i[id name sis_source_id integration_data group_weight].freeze
}.freeze
API_SIS_ASSIGNMENT_COURSE_SECTION_JSON_OPTS = {
- only: %i(id name sis_source_id integration_id).freeze
+ only: %i[id name sis_source_id integration_id].freeze
}.freeze
API_SIS_ASSIGNMENT_COURSE_JSON_OPTS = {
- only: %i(id name sis_source_id integration_id).freeze
+ only: %i[id name sis_source_id integration_id].freeze
}.freeze
API_SIS_ASSIGNMENT_OVERRIDES_JSON_OPTS = {
- only: %i(id title due_at unlock_at lock_at).freeze
+ only: %i[id title due_at unlock_at lock_at].freeze
}.freeze
API_SIS_ASSIGNMENT_STUDENT_OVERRIDES_JSON_OPTS = {
- only: %i(user_id).freeze
+ only: %i[user_id].freeze
}.freeze
def sis_assignments_json(assignments, includes = {})
diff --git a/lib/api/v1/stream_item.rb b/lib/api/v1/stream_item.rb
index 94ec503f68d..ab18d825938 100644
--- a/lib/api/v1/stream_item.rb
+++ b/lib/api/v1/stream_item.rb
@@ -87,7 +87,7 @@ module Api::V1::StreamItem
when 'Submission'
submission = stream_item.asset
assignment = submission.assignment
- includes = %w|submission_comments assignment course html_url user|
+ includes = %w[submission_comments assignment course html_url user]
json = submission_json(submission, assignment, current_user, session, nil, includes, params)
json.delete('id')
hash.merge! json
diff --git a/lib/api/v1/submission.rb b/lib/api/v1/submission.rb
index e219136c31d..cfe3d046620 100644
--- a/lib/api/v1/submission.rb
+++ b/lib/api/v1/submission.rb
@@ -139,11 +139,11 @@ module Api::V1::Submission
hash
end
- SUBMISSION_JSON_FIELDS = %w(id user_id url score grade excused attempt submission_type submitted_at body
+ SUBMISSION_JSON_FIELDS = %w[id user_id url score grade excused attempt submission_type submitted_at body
assignment_id graded_at grade_matches_current_submission grader_id workflow_state late_policy_status
- points_deducted grading_period_id cached_due_date extra_attempts posted_at).freeze
- SUBMISSION_JSON_METHODS = %w(late missing seconds_late entered_grade entered_score).freeze
- SUBMISSION_OTHER_FIELDS = %w(attachments discussion_entries).freeze
+ points_deducted grading_period_id cached_due_date extra_attempts posted_at].freeze
+ SUBMISSION_JSON_METHODS = %w[late missing seconds_late entered_grade entered_score].freeze
+ SUBMISSION_OTHER_FIELDS = %w[attachments discussion_entries].freeze
def submission_attempt_json(attempt, assignment, user, session, context = nil, params = {}, quiz_submission_version = nil)
context ||= assignment.context
diff --git a/lib/api/v1/submission_comment.rb b/lib/api/v1/submission_comment.rb
index a5b5a0883b4..fd6966bd1b1 100644
--- a/lib/api/v1/submission_comment.rb
+++ b/lib/api/v1/submission_comment.rb
@@ -38,7 +38,7 @@ module Api::V1::SubmissionComment
def submission_comment_json(submission_comment, user)
sc_hash = submission_comment.as_json(
:include_root => false,
- :only => %w(id author_id author_name created_at edited_at comment)
+ :only => %w[id author_id author_name created_at edited_at comment]
)
if submission_comment.media_comment?
diff --git a/lib/api/v1/usage_rights.rb b/lib/api/v1/usage_rights.rb
index 40d3f67d089..b4d91415628 100644
--- a/lib/api/v1/usage_rights.rb
+++ b/lib/api/v1/usage_rights.rb
@@ -23,6 +23,6 @@ module Api::V1::UsageRights
include Api::V1::User
def usage_rights_json(usage_rights, current_user)
- api_json(usage_rights, current_user, session, :only => %w(legal_copyright use_justification license), :methods => %w(license_name))
+ api_json(usage_rights, current_user, session, :only => %w[legal_copyright use_justification license], :methods => %w[license_name])
end
end
diff --git a/lib/api/v1/user.rb b/lib/api/v1/user.rb
index e6fcc972325..0a4a8261fd4 100644
--- a/lib/api/v1/user.rb
+++ b/lib/api/v1/user.rb
@@ -24,8 +24,8 @@ module Api::V1::User
include AvatarHelper
API_USER_JSON_OPTS = {
- :only => %w(id name created_at).freeze,
- :methods => %w(sortable_name short_name).freeze
+ :only => %w[id name created_at].freeze,
+ :methods => %w[sortable_name short_name].freeze
}.freeze
def user_json_preloads(users, preload_email = false, opts = {})
@@ -298,7 +298,7 @@ module Api::V1::User
json[:sis_user_id] = pseudonym.try(:sis_user_id)
end
json[:html_url] = course_user_url(enrollment.course_id, enrollment.user_id)
- user_includes = includes & %w{avatar_url group_ids uuid}
+ user_includes = includes & %w[avatar_url group_ids uuid]
json[:user] = user_json(enrollment.user, user, session, user_includes, @context, nil, []) if includes.include?(:user)
if includes.include?('locked')
diff --git a/lib/api/v1/user_profile.rb b/lib/api/v1/user_profile.rb
index 0c963432046..6b551f3e2d3 100644
--- a/lib/api/v1/user_profile.rb
+++ b/lib/api/v1/user_profile.rb
@@ -72,11 +72,11 @@ module Api::V1::UserProfile
def user_service_json(user_service, current_user, session)
api_json(user_service, current_user, session,
- :only => %w(service visible),
+ :only => %w[service visible],
:methods => %(service_user_link))
end
def user_profile_link_json(link, current_user, session)
- api_json(link, current_user, session, :only => %w(url title))
+ api_json(link, current_user, session, :only => %w[url title])
end
end
diff --git a/lib/api/v1/wiki_page.rb b/lib/api/v1/wiki_page.rb
index f37ecabd789..f402c823f44 100644
--- a/lib/api/v1/wiki_page.rb
+++ b/lib/api/v1/wiki_page.rb
@@ -24,7 +24,7 @@ module Api::V1::WikiPage
include Api::V1::Locked
include Api::V1::Assignment
- WIKI_PAGE_JSON_ATTRS = %w(url title created_at editing_roles).freeze
+ WIKI_PAGE_JSON_ATTRS = %w[url title created_at editing_roles].freeze
def wiki_page_json(wiki_page, current_user, session, include_body = true, opts = {})
opts = opts.reverse_merge(include_assignment: true, assignment_opts: {})
diff --git a/lib/authentication_methods.rb b/lib/authentication_methods.rb
index 38957303c03..407282c7c5d 100644
--- a/lib/authentication_methods.rb
+++ b/lib/authentication_methods.rb
@@ -90,7 +90,7 @@ module AuthenticationMethods
end
end
- ALLOWED_SCOPE_INCLUDES = %w{uuid}.freeze
+ ALLOWED_SCOPE_INCLUDES = %w[uuid].freeze
def filter_includes(key)
# no funny business
@@ -237,7 +237,7 @@ module AuthenticationMethods
# required by the user throttling middleware
session[:user_id] = @current_user.global_id if @current_user
- if @current_user && %w(become_user_id me become_teacher become_student).any? { |k| params.key?(k) }
+ if @current_user && %w[become_user_id me become_teacher become_student].any? { |k| params.key?(k) }
request_become_user = nil
if params[:become_user_id]
request_become_user = User.where(id: params[:become_user_id]).first
@@ -394,7 +394,7 @@ module AuthenticationMethods
end
def add_www_authenticate_header
- response['WWW-Authenticate'] = %{Bearer realm="canvas-lms"}
+ response['WWW-Authenticate'] = %(Bearer realm="canvas-lms")
end
# Reset the session, and copy the specified keys over to the new session.
diff --git a/lib/basic_lti/basic_outcomes.rb b/lib/basic_lti/basic_outcomes.rb
index 45debc392c1..84a7e14741b 100644
--- a/lib/basic_lti/basic_outcomes.rb
+++ b/lib/basic_lti/basic_outcomes.rb
@@ -377,16 +377,16 @@ module BasicLTI
def handle_read_result(_, assignment, user)
@submission = assignment.submission_for_student(user)
- self.body = %{
-
-
-
- en
- #{submission_score}
-
-
-
- }
+ self.body = <<~XML
+
+
+
+ en
+ #{submission_score}
+
+
+
+ XML
true
end
diff --git a/lib/canvas/cache_register.rb b/lib/canvas/cache_register.rb
index 5138ab95a56..2078721d97a 100644
--- a/lib/canvas/cache_register.rb
+++ b/lib/canvas/cache_register.rb
@@ -33,16 +33,16 @@ module Canvas
# (which is far less often than the many times per day users are currently being touched)
ALLOWED_TYPES = {
- 'Account' => %w{account_chain role_overrides global_navigation feature_flags brand_config default_locale
- resolved_outcome_proficiency resolved_outcome_calculation_method},
- 'Course' => %w{account_associations conditional_release},
- 'User' => %w{enrollments groups account_users todo_list submissions user_services k5_user},
- 'Assignment' => %w{availability conditional_release needs_grading},
- 'Quizzes::Quiz' => %w{availability}
+ 'Account' => %w[account_chain role_overrides global_navigation feature_flags brand_config default_locale
+ resolved_outcome_proficiency resolved_outcome_calculation_method],
+ 'Course' => %w[account_associations conditional_release],
+ 'User' => %w[enrollments groups account_users todo_list submissions user_services k5_user],
+ 'Assignment' => %w[availability conditional_release needs_grading],
+ 'Quizzes::Quiz' => %w[availability]
}.freeze
PREFER_MULTI_CACHE_TYPES = {
- 'Account' => %w{feature_flags}
+ 'Account' => %w[feature_flags]
}.freeze
MIGRATED_TYPES = {}.freeze # for someday when we're reasonably sure we've moved all the cache keys for a type over
diff --git a/lib/canvas/cassandra/migration.rb b/lib/canvas/cassandra/migration.rb
index 76f3a6d44d3..1f812977677 100644
--- a/lib/canvas/cassandra/migration.rb
+++ b/lib/canvas/cassandra/migration.rb
@@ -36,11 +36,11 @@ module Canvas
end
def cassandra_table_exists?(table)
- cql = %{
+ cql = <<~SQL.squish
SELECT *
FROM #{table}
LIMIT 1
- }
+ SQL
cassandra.execute(cql)
true
rescue CassandraCQL::Error::InvalidRequestException
@@ -48,11 +48,11 @@ module Canvas
end
def cassandra_column_exists?(table, column)
- cql = %{
+ cql = <<~SQL.squish
SELECT #{column}
FROM #{table}
LIMIT 1
- }
+ SQL
cassandra.execute(cql)
true
rescue CassandraCQL::Error::InvalidRequestException
diff --git a/lib/canvas/migration/package_identifier.rb b/lib/canvas/migration/package_identifier.rb
index 9704bf27791..8e56c3b51bb 100644
--- a/lib/canvas/migration/package_identifier.rb
+++ b/lib/canvas/migration/package_identifier.rb
@@ -53,8 +53,8 @@ module Canvas::Migration
doc = create_xml_doc(data)
if COMMON_CARTRIDGE_REGEX.match?(get_node_val(doc, 'metadata schema'))
- if doc.at_css(%{resources resource[href="#{CC::CCHelper::COURSE_SETTINGS_DIR}/#{CC::CCHelper::SYLLABUS}"] file[href="#{CC::CCHelper::COURSE_SETTINGS_DIR}/#{CC::CCHelper::COURSE_SETTINGS}"]}) ||
- doc.at_css(%{resources resource[href="#{CC::CCHelper::COURSE_SETTINGS_DIR}/#{CC::CCHelper::CANVAS_EXPORT_FLAG}"]})
+ if doc.at_css(%(resources resource[href="#{CC::CCHelper::COURSE_SETTINGS_DIR}/#{CC::CCHelper::SYLLABUS}"] file[href="#{CC::CCHelper::COURSE_SETTINGS_DIR}/#{CC::CCHelper::COURSE_SETTINGS}"])) ||
+ doc.at_css(%(resources resource[href="#{CC::CCHelper::COURSE_SETTINGS_DIR}/#{CC::CCHelper::CANVAS_EXPORT_FLAG}"]))
:canvas_cartridge
elsif get_node_val(doc, 'metadata schemaversion') == "1.0.0"
:common_cartridge_1_0
diff --git a/lib/canvas/password_policy.rb b/lib/canvas/password_policy.rb
index 51e60e53680..ab2c94b41ba 100644
--- a/lib/canvas/password_policy.rb
+++ b/lib/canvas/password_policy.rb
@@ -57,7 +57,7 @@ module Canvas
end
# per http://www.prweb.com/releases/2012/10/prweb10046001.htm
- COMMON_PASSWORDS = %w{
+ COMMON_PASSWORDS = %w[
password
123456
12345678
@@ -83,6 +83,6 @@ module Canvas
ninja
mustang
password1
- }.freeze
+ ].freeze
end
end
diff --git a/lib/canvas/plugins/default_plugins.rb b/lib/canvas/plugins/default_plugins.rb
index f3da2f196df..5cd016074c3 100644
--- a/lib/canvas/plugins/default_plugins.rb
+++ b/lib/canvas/plugins/default_plugins.rb
@@ -187,7 +187,7 @@ module Canvas::Plugins::DefaultPlugins
:migration_partial => 'canvas_config',
:requires_file_upload => true,
:provides => { :canvas_cartridge => CC::Importer::Canvas::Converter },
- :valid_contexts => %w{Account Course}
+ :valid_contexts => %w[Account Course]
},
}
require_dependency 'canvas/migration/worker/course_copy_worker'
@@ -206,7 +206,7 @@ module Canvas::Plugins::DefaultPlugins
:skip_conversion_step => true,
:required_options_validator => Canvas::Migration::Validators::CourseCopyValidator,
:required_settings => [:source_course_id],
- :valid_contexts => %w{Course}
+ :valid_contexts => %w[Course]
},
}
require_dependency 'canvas/migration/worker/zip_file_worker'
@@ -225,7 +225,7 @@ module Canvas::Plugins::DefaultPlugins
:no_selective_import => true,
:required_options_validator => Canvas::Migration::Validators::ZipImporterValidator,
:required_settings => [:source_folder_id],
- :valid_contexts => %w(Course Group User)
+ :valid_contexts => %w[Course Group User]
},
}
Canvas::Plugin.register 'common_cartridge_importer', :export_system, {
@@ -245,7 +245,7 @@ module Canvas::Plugins::DefaultPlugins
:common_cartridge_1_1 => CC::Importer::Standard::Converter,
:common_cartridge_1_2 => CC::Importer::Standard::Converter,
:common_cartridge_1_3 => CC::Importer::Standard::Converter },
- :valid_contexts => %w{Account Course}
+ :valid_contexts => %w[Account Course]
},
}
Canvas::Plugin.register('grade_export', :sis, {
diff --git a/lib/canvas/security/jwt_validator.rb b/lib/canvas/security/jwt_validator.rb
index e991b71d89d..72d047e86cf 100644
--- a/lib/canvas/security/jwt_validator.rb
+++ b/lib/canvas/security/jwt_validator.rb
@@ -20,7 +20,7 @@
module Canvas::Security
class JwtValidator
include ActiveModel::Validations
- REQUIRED_ASSERTIONS = Set.new(%w(sub aud exp iat jti))
+ REQUIRED_ASSERTIONS = Set.new(%w[sub aud exp iat jti])
validate :assertions, :aud, :exp, :iat, :jti
diff --git a/lib/cc/cc_helper.rb b/lib/cc/cc_helper.rb
index e5722d10939..c02a4e2564c 100644
--- a/lib/cc/cc_helper.rb
+++ b/lib/cc/cc_helper.rb
@@ -328,10 +328,10 @@ module CC
meta_fields.each_pair do |k, v|
next unless v.present?
- meta_html += %{\n}
+ meta_html += %(\n)
end
- %{\n\n\n#{HtmlTextHelper.escape_html(title)}\n#{meta_html}\n\n#{content}\n\n}
+ %(\n\n\n#{HtmlTextHelper.escape_html(title)}\n#{meta_html}\n\n#{content}\n\n)
end
def html_content(html)
diff --git a/lib/cc/exporter/epub/converters/topic_epub_converter.rb b/lib/cc/exporter/epub/converters/topic_epub_converter.rb
index c14654b2043..08e429e4c06 100644
--- a/lib/cc/exporter/epub/converters/topic_epub_converter.rb
+++ b/lib/cc/exporter/epub/converters/topic_epub_converter.rb
@@ -29,7 +29,7 @@ module CC::Exporter::Epub::Converters
cc_path = @package_root.item_path res.at_css('file')['href']
canvas_id = get_node_att(res, 'dependency', 'identifierref')
- if canvas_id && (meta_res = @manifest.at_css(%{resource[identifier="#{canvas_id}"]}))
+ if canvas_id && (meta_res = @manifest.at_css(%(resource[identifier="#{canvas_id}"])))
canvas_path = @package_root.item_path meta_res.at_css('file')['href']
meta_node = open_file_xml(canvas_path)
else
diff --git a/lib/cc/importer/canvas/quiz_metadata_converter.rb b/lib/cc/importer/canvas/quiz_metadata_converter.rb
index ff761c29738..1260946c49f 100644
--- a/lib/cc/importer/canvas/quiz_metadata_converter.rb
+++ b/lib/cc/importer/canvas/quiz_metadata_converter.rb
@@ -54,7 +54,7 @@ module CC::Importer::Canvas
quiz['hide_correct_answers_at'] = get_time_val(doc, 'hide_correct_answers_at')
quiz['time_limit'] = get_int_val(doc, 'time_limit')
quiz['allowed_attempts'] = get_int_val(doc, 'allowed_attempts')
- %w(
+ %w[
could_be_locked
anonymous_submissions
show_correct_answers
@@ -69,7 +69,7 @@ module CC::Importer::Canvas
one_time_results
show_correct_answers_last_attempt
only_visible_to_overrides
- ).each do |bool_val|
+ ].each do |bool_val|
val = get_bool_val(doc, bool_val)
quiz[bool_val] = val unless val.nil?
end
diff --git a/lib/cc/importer/canvas/topic_converter.rb b/lib/cc/importer/canvas/topic_converter.rb
index 53ccf2afbf3..1d34199a13e 100644
--- a/lib/cc/importer/canvas/topic_converter.rb
+++ b/lib/cc/importer/canvas/topic_converter.rb
@@ -29,7 +29,7 @@ module CC::Importer::Canvas
cc_path = @package_root.item_path res.at_css('file')['href']
cc_id = res['identifier']
canvas_id = get_node_att(res, 'dependency', 'identifierref')
- if canvas_id && (meta_res = @manifest.at_css(%{resource[identifier="#{canvas_id}"]}))
+ if canvas_id && (meta_res = @manifest.at_css(%(resource[identifier="#{canvas_id}"])))
canvas_path = @package_root.item_path meta_res.at_css('file')['href']
meta_node = open_file_xml(canvas_path)
else
@@ -70,7 +70,7 @@ module CC::Importer::Canvas
topic['workflow_state'] = wf_state if wf_state.present?
topic['group_category'] = get_node_val(meta_doc, 'group_category')
topic['todo_date'] = get_time_val(meta_doc, 'todo_date')
- %w(has_group_category allow_rating only_graders_can_rate sort_by_rating locked).each do |setting|
+ %w[has_group_category allow_rating only_graders_can_rate sort_by_rating locked].each do |setting|
get_bool_val(meta_doc, setting).tap { |val| topic[setting] = val unless val.nil? }
end
if (asmnt_node = meta_doc.at_css('assignment'))
diff --git a/lib/cc/lti_resource_links.rb b/lib/cc/lti_resource_links.rb
index 532d23c711c..712fbf3ae81 100644
--- a/lib/cc/lti_resource_links.rb
+++ b/lib/cc/lti_resource_links.rb
@@ -87,13 +87,13 @@ module CC
'xmlns:lticm' => 'http://www.imsglobal.org/xsd/imslticm_v1p0',
'xmlns:lticp' => 'http://www.imsglobal.org/xsd/imslticp_v1p0',
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
- 'xsi:schemaLocation' => %w(
+ 'xsi:schemaLocation' => %w[
http://www.imsglobal.org/xsd/imslticc_v1p3.xsd
http://www.imsglobal.org/xsd/imslticp_v1p0
imslticp_v1p0.xsd http://www.imsglobal.org/xsd/imslticm_v1p0
imslticm_v1p0.xsd http://www.imsglobal.org/xsd/imsbasiclti_v1p0
imsbasiclti_v1p0p1.xsd
- ).join(' ')
+ ].join(' ')
) do |cartridge_basiclti_link|
# Basic elements
cartridge_basiclti_link.blti :title, tool.name
diff --git a/lib/cc/qti/qti_manifest.rb b/lib/cc/qti/qti_manifest.rb
index 50a68a636f5..ced193cb819 100644
--- a/lib/cc/qti/qti_manifest.rb
+++ b/lib/cc/qti/qti_manifest.rb
@@ -119,7 +119,7 @@ module CC
md.imsmd :lom do |lom|
lom.imsmd :general do |general|
general.imsmd :title do |title|
- title.imsmd :string, %{QTI Quiz Export for course "#{course.name}"}
+ title.imsmd :string, %(QTI Quiz Export for course "#{course.name}")
end
end
lom.imsmd :lifeCycle do |general|
diff --git a/lib/course_link_validator.rb b/lib/course_link_validator.rb
index f04c9893d4a..aedd54b2d91 100644
--- a/lib/course_link_validator.rb
+++ b/lib/course_link_validator.rb
@@ -307,7 +307,7 @@ class CourseLinkValidator
begin
response = CanvasHttp.head(url, { "Accept-Encoding" => "gzip" }, redirect_limit: 9, redirect_spy: redirect_proc)
- if %w{404 405}.include?(response.code)
+ if %w[404 405].include?(response.code)
response = CanvasHttp.get(url, { "Accept-Encoding" => "gzip" }, redirect_limit: 9, redirect_spy: redirect_proc) do
# don't read the response body
end
diff --git a/lib/custom_validations.rb b/lib/custom_validations.rb
index 528dbe0909d..c02a80b079a 100644
--- a/lib/custom_validations.rb
+++ b/lib/custom_validations.rb
@@ -20,7 +20,7 @@
module CustomValidations
module ClassMethods
- def validates_as_url(*fields, allowed_schemes: %w{http https})
+ def validates_as_url(*fields, allowed_schemes: %w[http https])
validates_each(fields, :allow_nil => true) do |record, attr, value|
value, = CanvasHttp.validate_url(value, allowed_schemes: allowed_schemes)
diff --git a/lib/data_fixup/add_role_overrides_for_new_permission.rb b/lib/data_fixup/add_role_overrides_for_new_permission.rb
index 5baeb4ea2d6..89e53543a66 100644
--- a/lib/data_fixup/add_role_overrides_for_new_permission.rb
+++ b/lib/data_fixup/add_role_overrides_for_new_permission.rb
@@ -41,7 +41,7 @@ module DataFixup::AddRoleOverridesForNewPermission
new_ro = RoleOverride.new
new_ro.permission = new_permission
- attrs = ro.attributes.slice(*%w{context_type context_id role_id locked enabled applies_to_self applies_to_descendants applies_to_env root_account_id})
+ attrs = ro.attributes.slice(*%w[context_type context_id role_id locked enabled applies_to_self applies_to_descendants applies_to_env root_account_id])
new_ro.assign_attributes(attrs)
new_ro.save!
end
diff --git a/lib/data_fixup/init_account_index_for_course_audit_log.rb b/lib/data_fixup/init_account_index_for_course_audit_log.rb
index 7a99e973f89..b250723a497 100644
--- a/lib/data_fixup/init_account_index_for_course_audit_log.rb
+++ b/lib/data_fixup/init_account_index_for_course_audit_log.rb
@@ -49,19 +49,19 @@ module DataFixup
end
def drop_table
- database.execute %{DROP TABLE #{LAST_BATCH_TABLE};}
+ database.execute %(DROP TABLE #{LAST_BATCH_TABLE};)
end
- SEARCH_CQL = %{
+ SEARCH_CQL = <<~SQL.squish
SELECT id, created_at, course_id, account_id
FROM courses
WHERE token(id) > token(?)
LIMIT ?
- }
+ SQL
- UPDATE_CQL = %{
+ UPDATE_CQL = <<~SQL.squish
UPDATE courses SET account_id = ? WHERE id = ?
- }
+ SQL
ResultStruct = Struct.new(:index, :record, :key)
@@ -172,11 +172,11 @@ module DataFixup
end
def table_exists?(table)
- cql = %{
+ cql = <<~SQL.squish
SELECT *
FROM #{table}
LIMIT 1
- }
+ SQL
database.execute(cql)
true
rescue CassandraCQL::Error::InvalidRequestException
diff --git a/lib/data_fixup/lti/fill_custom_claim_columns_for_resource_link.rb b/lib/data_fixup/lti/fill_custom_claim_columns_for_resource_link.rb
index fee1b7ef2c7..ed7d5dc1341 100644
--- a/lib/data_fixup/lti/fill_custom_claim_columns_for_resource_link.rb
+++ b/lib/data_fixup/lti/fill_custom_claim_columns_for_resource_link.rb
@@ -28,18 +28,18 @@ module DataFixup::Lti::FillCustomClaimColumnsForResourceLink
end
def self.drop_resource_links_without_a_context
- Lti::LineItem.connection.execute(%{
+ Lti::LineItem.connection.execute(<<~SQL.squish)
DELETE FROM #{Lti::LineItem.quoted_table_name}
WHERE lti_resource_link_id IN (
SELECT ID FROM #{Lti::ResourceLink.quoted_table_name}
WHERE context_type IS NULL OR context_id IS NULL
);
- })
+ SQL
- Lti::ResourceLink.connection.execute(%{
+ Lti::ResourceLink.connection.execute(<<~SQL.squish)
DELETE FROM #{Lti::ResourceLink.quoted_table_name}
WHERE context_type IS NULL OR context_id IS NULL;
- })
+ SQL
end
def self.update_context!
diff --git a/lib/data_fixup/populate_root_account_id_on_asset_user_accesses.rb b/lib/data_fixup/populate_root_account_id_on_asset_user_accesses.rb
index 2541c5908f6..73e99dd10d8 100644
--- a/lib/data_fixup/populate_root_account_id_on_asset_user_accesses.rb
+++ b/lib/data_fixup/populate_root_account_id_on_asset_user_accesses.rb
@@ -22,7 +22,7 @@ module DataFixup::PopulateRootAccountIdOnAssetUserAccesses
# all other context types are handled in PopulateRootAccountIdOnModels
to_transform = AssetUserAccess.where(id: min..max, context_type: "User")
- asset_types = %w(attachment calendar_event group course)
+ asset_types = %w[attachment calendar_event group course]
# find any other asset types besides these and "user" (which the backfill fills with 0)
types_string = [*asset_types, "user"].map { |t| "'%#{t}%'" }.join(',')
diff --git a/lib/feature.rb b/lib/feature.rb
index 71275dead33..69048360e40 100644
--- a/lib/feature.rb
+++ b/lib/feature.rb
@@ -29,7 +29,7 @@ class Feature
@state = 'allowed'
opts.each do |key, val|
next unless ATTRS.include?(key)
- next if key == :state && !%w(hidden off allowed on allowed_on).include?(val)
+ next if key == :state && !%w[hidden off allowed on allowed_on].include?(val)
instance_variable_set "@#{key}", val
end
@@ -132,9 +132,9 @@ class Feature
STATE_DISABLED = 'disabled'
VALID_STATES = [STATE_ON, STATE_DEFAULT_OFF, STATE_DEFAULT_ON, STATE_HIDDEN, STATE_DISABLED].freeze
- VALID_APPLIES_TO = %w(Course Account RootAccount User SiteAdmin).freeze
- VALID_ENVS = %i(development ci beta test production).freeze
- VALID_TYPES = %w(feature_option setting).freeze
+ VALID_APPLIES_TO = %w[Course Account RootAccount User SiteAdmin].freeze
+ VALID_ENVS = %i[development ci beta test production].freeze
+ VALID_TYPES = %w[feature_option setting].freeze
DISABLED_FEATURE = Feature.new.freeze
diff --git a/lib/google_docs_preview.rb b/lib/google_docs_preview.rb
index 4e05371ab59..0ee3bfc588f 100644
--- a/lib/google_docs_preview.rb
+++ b/lib/google_docs_preview.rb
@@ -19,7 +19,7 @@
#
module GoogleDocsPreview
- PREVIEWABLE_TYPES = %w{
+ PREVIEWABLE_TYPES = %w[
application/vnd.openxmlformats-officedocument.wordprocessingml.template
application/vnd.oasis.opendocument.spreadsheet
application/vnd.sun.xml.writer
@@ -43,7 +43,7 @@ module GoogleDocsPreview
application/postscript
application/pdf
application/vnd.ms-powerpoint
- }.freeze
+ ].freeze
def self.previewable?(account, attachment)
account&.service_enabled?(:google_docs_previews) &&
diff --git a/lib/gradebook_importer.rb b/lib/gradebook_importer.rb
index 69855a6ce80..0d7105e41a9 100644
--- a/lib/gradebook_importer.rb
+++ b/lib/gradebook_importer.rb
@@ -21,10 +21,10 @@
require 'csv'
class GradebookImporter
- ASSIGNMENT_PRELOADED_FIELDS = %i/
+ ASSIGNMENT_PRELOADED_FIELDS = %i[
id title points_possible grading_type updated_at context_id context_type group_category_id
created_at due_at only_visible_to_overrides moderated_grading grades_published_at final_grader_id
- /.freeze
+ ].freeze
class NegativeId
class << self
@@ -696,7 +696,7 @@ class GradebookImporter
csv_file = attachment.open(need_local_file: true)
is_semicolon_delimited = semicolon_delimited?(csv_file)
csv_parse_options = {
- converters: %i(nil decimal_comma_to_period),
+ converters: %i[nil decimal_comma_to_period],
skip_lines: /^[;, ]+$/,
col_sep: is_semicolon_delimited ? ";" : ","
}
diff --git a/lib/has_content_tags.rb b/lib/has_content_tags.rb
index a29343a5eec..79d4509310e 100644
--- a/lib/has_content_tags.rb
+++ b/lib/has_content_tags.rb
@@ -30,7 +30,7 @@ module HasContentTags
def check_if_associated_content_tags_need_updating
@associated_content_tags_need_updating = false
return if self.new_record?
- return if self.respond_to?(:context_type) && %w{SisBatch Folder}.include?(self.context_type)
+ return if self.respond_to?(:context_type) && %w[SisBatch Folder].include?(self.context_type)
@associated_content_tags_need_updating = true if self.respond_to?(:title_changed?) && self.title_changed?
@associated_content_tags_need_updating = true if self.respond_to?(:name_changed?) && self.name_changed?
diff --git a/lib/lti/app_launch_collator.rb b/lib/lti/app_launch_collator.rb
index 3c0c66708b3..3367249b6df 100644
--- a/lib/lti/app_launch_collator.rb
+++ b/lib/lti/app_launch_collator.rb
@@ -19,11 +19,11 @@
#
module Lti
class AppLaunchCollator
- CONTENT_MESSAGE_TYPES = %w(
+ CONTENT_MESSAGE_TYPES = %w[
ContentItemSelection
ContentItemSelectionRequest
LtiDeepLinkingRequest
- ).freeze
+ ].freeze
class << self
def external_tools_for(context, placements, options = {})
diff --git a/lib/lti/content_item_response.rb b/lib/lti/content_item_response.rb
index 71c202f3aac..54a56b7911c 100644
--- a/lib/lti/content_item_response.rb
+++ b/lib/lti/content_item_response.rb
@@ -24,7 +24,7 @@
module Lti
class ContentItemResponse
MEDIA_TYPES = [:assignments, :discussion_topics, :modules, :module_items, :pages, :quizzes, :files].freeze
- SUPPORTED_EXPORT_TYPES = %w(common_cartridge).freeze
+ SUPPORTED_EXPORT_TYPES = %w[common_cartridge].freeze
def initialize(context, controller, current_user, media_types, export_type)
@context = context
diff --git a/lib/lti/content_item_selection_request.rb b/lib/lti/content_item_selection_request.rb
index e22b0ba5413..c1e2172e5c2 100644
--- a/lib/lti/content_item_selection_request.rb
+++ b/lib/lti/content_item_selection_request.rb
@@ -129,7 +129,7 @@ module Lti
end
end
- INDEX_MENU_TOOL_TYPES = %w{
+ INDEX_MENU_TOOL_TYPES = %w[
assignment_index_menu
assignment_group_menu
discussion_topic_index_menu
@@ -138,7 +138,7 @@ module Lti
module_group_menu
quiz_index_menu
wiki_index_menu
- }.freeze
+ ].freeze
def placement_params(placement, assignment: nil)
case placement
@@ -161,19 +161,19 @@ module Lti
end
def migration_selection_params
- accept_media_types = %w(
+ accept_media_types = %w[
application/vnd.ims.imsccv1p1
application/vnd.ims.imsccv1p2
application/vnd.ims.imsccv1p3
application/zip
application/xml
- )
+ ]
{
accept_media_types: accept_media_types.join(','),
accept_presentation_document_targets: 'download',
accept_copy_advice: true,
- ext_content_file_extensions: %w(zip imscc mbz xml).join(','),
+ ext_content_file_extensions: %w[zip imscc mbz xml].join(','),
accept_unsigned: true,
auto_create: false
}
@@ -181,8 +181,8 @@ module Lti
def editor_button_params
{
- accept_media_types: %w(image/* text/html application/vnd.ims.lti.v1.ltilink */*).join(','),
- accept_presentation_document_targets: %w(embed frame iframe window).join(','),
+ accept_media_types: %w[image/* text/html application/vnd.ims.lti.v1.ltilink */*].join(','),
+ accept_presentation_document_targets: %w[embed frame iframe window].join(','),
accept_unsigned: true,
accept_multiple: true,
auto_create: false
@@ -192,7 +192,7 @@ module Lti
def lti_launch_selection_params
{
accept_media_types: 'application/vnd.ims.lti.v1.ltilink',
- accept_presentation_document_targets: %w(frame window).join(','),
+ accept_presentation_document_targets: %w[frame window].join(','),
accept_unsigned: true,
auto_create: false
}
diff --git a/lib/lti/messages/deep_linking_request.rb b/lib/lti/messages/deep_linking_request.rb
index 0796ec78b0e..7a13eb62e4f 100644
--- a/lib/lti/messages/deep_linking_request.rb
+++ b/lib/lti/messages/deep_linking_request.rb
@@ -35,77 +35,77 @@ module Lti::Messages
DEEP_LINKING_DETAILS = {
'assignment_selection' => {
accept_multiple: false,
- accept_types: %w(ltiResourceLink).freeze,
+ accept_types: %w[ltiResourceLink].freeze,
auto_create: false,
- document_targets: %w(iframe window).freeze,
- media_types: %w(application/vnd.ims.lti.v1.ltilink).freeze
+ document_targets: %w[iframe window].freeze,
+ media_types: %w[application/vnd.ims.lti.v1.ltilink].freeze
}.freeze,
'collaboration' => {
accept_multiple: false,
- accept_types: %w(ltiResourceLink).freeze,
+ accept_types: %w[ltiResourceLink].freeze,
auto_create: true,
- document_targets: %w(iframe).freeze,
- media_types: %w(application/vnd.ims.lti.v1.ltilink).freeze
+ document_targets: %w[iframe].freeze,
+ media_types: %w[application/vnd.ims.lti.v1.ltilink].freeze
}.freeze,
'conference_selection' => {
accept_multiple: false,
- accept_types: %w(link html).freeze,
+ accept_types: %w[link html].freeze,
auto_create: true,
- document_targets: %w(iframe window).freeze,
- media_types: %w(text/html */*).freeze
+ document_targets: %w[iframe window].freeze,
+ media_types: %w[text/html */*].freeze
}.freeze,
'course_assignments_menu' => {
accept_multiple: true,
- accept_types: %w(ltiResourceLink).freeze,
+ accept_types: %w[ltiResourceLink].freeze,
auto_create: false,
- document_targets: %w(iframe window).freeze,
- media_types: %w(application/vnd.ims.lti.v1.ltilink).freeze
+ document_targets: %w[iframe window].freeze,
+ media_types: %w[application/vnd.ims.lti.v1.ltilink].freeze
}.freeze,
'editor_button' => {
accept_multiple: true,
- accept_types: %w(link file html ltiResourceLink image).freeze,
+ accept_types: %w[link file html ltiResourceLink image].freeze,
auto_create: false,
- document_targets: %w(embed iframe window).freeze,
- media_types: %w(image/* text/html application/vnd.ims.lti.v1.ltilink */*).freeze
+ document_targets: %w[embed iframe window].freeze,
+ media_types: %w[image/* text/html application/vnd.ims.lti.v1.ltilink */*].freeze
}.freeze,
'homework_submission' => {
accept_multiple: false,
- accept_types: %w(file ltiResourceLink).freeze,
+ accept_types: %w[file ltiResourceLink].freeze,
auto_create: false,
- document_targets: %w(iframe).freeze,
- media_types: %w(*/*).freeze
+ document_targets: %w[iframe].freeze,
+ media_types: %w[*/*].freeze
}.freeze,
'link_selection' => {
accept_multiple: true,
- accept_types: %w(ltiResourceLink).freeze,
+ accept_types: %w[ltiResourceLink].freeze,
auto_create: false,
- document_targets: %w(iframe window).freeze,
- media_types: %w(application/vnd.ims.lti.v1.ltilink).freeze
+ document_targets: %w[iframe window].freeze,
+ media_types: %w[application/vnd.ims.lti.v1.ltilink].freeze
}.freeze,
'migration_selection' => {
accept_multiple: false,
- accept_types: %w(file).freeze,
+ accept_types: %w[file].freeze,
auto_create: false,
- document_targets: %w(iframe).freeze,
- media_types: %w(application/vnd.ims.imsccv1p1 application/vnd.ims.imsccv1p2 application/vnd.ims.imsccv1p3 application/zip application/xml).freeze
+ document_targets: %w[iframe].freeze,
+ media_types: %w[application/vnd.ims.imsccv1p1 application/vnd.ims.imsccv1p2 application/vnd.ims.imsccv1p3 application/zip application/xml].freeze
}.freeze,
'module_index_menu_modal' => {
accept_multiple: true,
- accept_types: %w(ltiResourceLink).freeze,
+ accept_types: %w[ltiResourceLink].freeze,
auto_create: true,
- document_targets: %w(iframe window).freeze,
- media_types: %w(application/vnd.ims.lti.v1.ltilink).freeze
+ document_targets: %w[iframe window].freeze,
+ media_types: %w[application/vnd.ims.lti.v1.ltilink].freeze
}.freeze,
'submission_type_selection' => {
accept_multiple: false,
- accept_types: %w(ltiResourceLink).freeze,
+ accept_types: %w[ltiResourceLink].freeze,
auto_create: false,
- document_targets: %w(iframe window).freeze,
- media_types: %w(application/vnd.ims.lti.v1.ltilink).freeze
+ document_targets: %w[iframe window].freeze,
+ media_types: %w[application/vnd.ims.lti.v1.ltilink].freeze
}.freeze
}.freeze
- MODAL_PLACEMENTS = %w(editor_button assignment_selection link_selection migration_selection course_assignments_menu module_index_menu_modal).freeze
+ MODAL_PLACEMENTS = %w[editor_button assignment_selection link_selection migration_selection course_assignments_menu module_index_menu_modal].freeze
def initialize(tool:, context:, user:, expander:, return_url:, opts: {})
super
diff --git a/lib/lti/oauth2/access_token.rb b/lib/lti/oauth2/access_token.rb
index 689090fc912..d2341403545 100644
--- a/lib/lti/oauth2/access_token.rb
+++ b/lib/lti/oauth2/access_token.rb
@@ -91,7 +91,7 @@ module Lti
end
def check_required_assertions(assertion_keys)
- missing_assertions = (%w(iss sub exp aud iat nbf jti) - assertion_keys)
+ missing_assertions = (%w[iss sub exp aud iat nbf jti] - assertion_keys)
if missing_assertions.present?
raise InvalidTokenError, "the following assertions are missing: #{missing_assertions.join(',')}"
end
diff --git a/lib/lti/plagiarism_subscriptions_helper.rb b/lib/lti/plagiarism_subscriptions_helper.rb
index ca424daf0f6..5d5c9570e2f 100644
--- a/lib/lti/plagiarism_subscriptions_helper.rb
+++ b/lib/lti/plagiarism_subscriptions_helper.rb
@@ -25,11 +25,11 @@ module Lti
end
SUBMISSION_EVENT_ID = 'vnd.Canvas.SubmissionEvent'
- EVENT_TYPES = %w(submission_created
+ EVENT_TYPES = %w[submission_created
plagiarism_resubmit
submission_updated
assignment_updated
- assignment_created).freeze
+ assignment_created].freeze
def initialize(tool_proxy)
@tool_proxy = tool_proxy
diff --git a/lib/lti/privacy_level_expander.rb b/lib/lti/privacy_level_expander.rb
index ece8eb87fb7..15e39c60051 100644
--- a/lib/lti/privacy_level_expander.rb
+++ b/lib/lti/privacy_level_expander.rb
@@ -20,13 +20,13 @@
module Lti
class PrivacyLevelExpander
- EMAIL_ONLY = %w(Person.email.primary).freeze
- INLCUDE_NAME = %w(Person.name.given Person.name.full Person.name.family).freeze
- PUBLIC = %w(Person.sourcedId CourseOffering.sourcedId)
+ EMAIL_ONLY = %w[Person.email.primary].freeze
+ INLCUDE_NAME = %w[Person.name.given Person.name.full Person.name.family].freeze
+ PUBLIC = %w[Person.sourcedId CourseOffering.sourcedId]
.concat(EMAIL_ONLY)
.concat(INLCUDE_NAME)
.freeze
- ANONYMOUS = %w(com.instructure.contextLabel).freeze
+ ANONYMOUS = %w[com.instructure.contextLabel].freeze
SUPPORTED_PARAMETERS_HASH = {
public: PUBLIC,
diff --git a/lib/lti/tool_proxy_validator.rb b/lib/lti/tool_proxy_validator.rb
index 08c8d16bd3e..3d29d8db828 100644
--- a/lib/lti/tool_proxy_validator.rb
+++ b/lib/lti/tool_proxy_validator.rb
@@ -99,7 +99,7 @@ module Lti
def restricted_security_profile_errors
messages = {}
- profiles = %w(oauth2_access_token_ws_security lti_jwt_ws_security)
+ profiles = %w[oauth2_access_token_ws_security lti_jwt_ws_security]
if tool_proxy.tool_profile.security_profiles.select { |s| profiles.include?(s.security_profile_name) }.present?
unless tool_proxy.enabled_capabilities.include?('Security.splitSecret')
messages[:restricted_security_profiles] = ['Security.splitSecret is required']
diff --git a/lib/microsoft_sync/settings_validator.rb b/lib/microsoft_sync/settings_validator.rb
index f73502b049d..831fd9a17e3 100644
--- a/lib/microsoft_sync/settings_validator.rb
+++ b/lib/microsoft_sync/settings_validator.rb
@@ -23,10 +23,10 @@ module MicrosoftSync
# primary use is in the Accounts controller.
class SettingsValidator
# A list of all sync settings, as a final source of truth.
- SYNC_SETTINGS = %i(microsoft_sync_enabled microsoft_sync_tenant microsoft_sync_login_attribute
- microsoft_sync_login_attribute_suffix microsoft_sync_remote_attribute).freeze
- VALID_SYNC_LOGIN_ATTRIBUTES = %w(email preferred_username sis_user_id integration_id).freeze
- VALID_SYNC_REMOTE_ATTRIBUTES = %w(userPrincipalName mail mailNickname).freeze
+ SYNC_SETTINGS = %i[microsoft_sync_enabled microsoft_sync_tenant microsoft_sync_login_attribute
+ microsoft_sync_login_attribute_suffix microsoft_sync_remote_attribute].freeze
+ VALID_SYNC_LOGIN_ATTRIBUTES = %w[email preferred_username sis_user_id integration_id].freeze
+ VALID_SYNC_REMOTE_ATTRIBUTES = %w[userPrincipalName mail mailNickname].freeze
attr_reader :settings, :account
diff --git a/lib/notification_message_creator.rb b/lib/notification_message_creator.rb
index 0aaec7f15c5..c851381d6f5 100644
--- a/lib/notification_message_creator.rb
+++ b/lib/notification_message_creator.rb
@@ -148,7 +148,7 @@ class NotificationMessageCreator
policy = effective_policy_for(user, channel)
# if the policy is not daily or weekly, it is either immediate which was
# picked up before in build_immediate_message_for, or it's never.
- return unless %w(daily weekly).include?(policy&.frequency)
+ return unless %w[daily weekly].include?(policy&.frequency)
build_summary_for(user, policy) if policy
end
diff --git a/lib/sis/admin_importer.rb b/lib/sis/admin_importer.rb
index 44f97b02f55..d422d5e6e97 100644
--- a/lib/sis/admin_importer.rb
+++ b/lib/sis/admin_importer.rb
@@ -64,7 +64,7 @@ module SIS
raise ImportError, "No role_id or role given for admin" if role.blank? && role_id.blank?
state = status.downcase.strip
- raise ImportError, "Invalid status #{status} for admin" unless %w(active deleted).include? state
+ raise ImportError, "Invalid status #{status} for admin" unless %w[active deleted].include? state
return if @batch.skip_deletes? && state == 'deleted'
get_account(account_id)
diff --git a/lib/sis/course_importer.rb b/lib/sis/course_importer.rb
index ef770c6529c..f48661d66a7 100644
--- a/lib/sis/course_importer.rb
+++ b/lib/sis/course_importer.rb
@@ -107,7 +107,7 @@ module SIS
course.sis_source_id = course_id
active_state = status.casecmp?('published') ? 'available' : 'claimed'
unless course.stuck_sis_fields.include?(:workflow_state)
- if %w(active unpublished published).include?(status.downcase)
+ if %w[active unpublished published].include?(status.downcase)
case course.workflow_state
when 'completed'
# not using active state here, because it has always been set to available
diff --git a/lib/sis/csv/diff_generator.rb b/lib/sis/csv/diff_generator.rb
index eb1c398b65b..56151d740a5 100644
--- a/lib/sis/csv/diff_generator.rb
+++ b/lib/sis/csv/diff_generator.rb
@@ -51,7 +51,7 @@ module SIS
{ :file_io => File.open(output_path, 'rb'), :row_count => row_count }
end
- VALID_ENROLLMENT_DROP_STATUS = %w(deleted inactive completed deleted_last_completed).freeze
+ VALID_ENROLLMENT_DROP_STATUS = %w[deleted inactive completed deleted_last_completed].freeze
def generate_csvs(previous_csvs, current_csvs)
generated = []
diff --git a/lib/sis/csv/import_refactored.rb b/lib/sis/csv/import_refactored.rb
index 4ab43089fc7..031cd219282 100644
--- a/lib/sis/csv/import_refactored.rb
+++ b/lib/sis/csv/import_refactored.rb
@@ -34,11 +34,11 @@ module SIS
# * Course must be imported before Section
# * Course and Section must be imported before Xlist
# * Course, Section, and User must be imported before Enrollment
- IMPORTERS = %i{change_sis_id account term abstract_course course section
+ IMPORTERS = %i[change_sis_id account term abstract_course course section
xlist user login enrollment admin group_category group group_membership
- grade_publishing_results user_observer}.freeze
+ grade_publishing_results user_observer].freeze
- HEADERS_TO_EXCLUDE_FOR_DOWNLOAD = %w{password ssha_password}.freeze
+ HEADERS_TO_EXCLUDE_FOR_DOWNLOAD = %w[password ssha_password].freeze
def initialize(root_account, opts = {})
opts = opts.with_indifferent_access
@@ -362,7 +362,7 @@ module SIS
def is_last_parallel_importer_of_type?(parallel_importer)
importer_type = parallel_importer.importer_type.to_sym
- return false if @batch.parallel_importers.where(:importer_type => importer_type, :workflow_state => %w{queued running retry}).exists?
+ return false if @batch.parallel_importers.where(:importer_type => importer_type, :workflow_state => %w[queued running retry]).exists?
SisBatch.transaction do
@batch.reload(:lock => true)
diff --git a/lib/sis/csv/login_importer.rb b/lib/sis/csv/login_importer.rb
index 2462d2cdc15..1d77bbee093 100644
--- a/lib/sis/csv/login_importer.rb
+++ b/lib/sis/csv/login_importer.rb
@@ -23,7 +23,7 @@ module SIS
# note these are account-level groups, not course groups
class LoginImporter < CSVBaseImporter
def self.login_csv?(row)
- (row & %w{existing_user_id existing_integration_id existing_canvas_user_id}).any?
+ (row & %w[existing_user_id existing_integration_id existing_canvas_user_id]).any?
end
def self.identifying_fields
diff --git a/lib/sis/csv/user_importer.rb b/lib/sis/csv/user_importer.rb
index 018f6d352a5..67d3a6e0c7e 100644
--- a/lib/sis/csv/user_importer.rb
+++ b/lib/sis/csv/user_importer.rb
@@ -22,7 +22,7 @@ module SIS
module CSV
class UserImporter < CSVBaseImporter
def self.user_csv?(row)
- login_csv = (row & %w{existing_user_id existing_integration_id existing_canvas_user_id}.freeze).empty?
+ login_csv = (row & %w[existing_user_id existing_integration_id existing_canvas_user_id].freeze).empty?
row.include?('user_id') && row.include?('login_id') && login_csv
end
diff --git a/lib/sis/enrollment_importer.rb b/lib/sis/enrollment_importer.rb
index 39729b76513..be2a28a7b24 100644
--- a/lib/sis/enrollment_importer.rb
+++ b/lib/sis/enrollment_importer.rb
@@ -292,7 +292,7 @@ module SIS
end
@courses_to_touch_ids.add(enrollment.course_id)
- if enrollment.should_update_user_account_association? && !%w{creation_pending deleted}.include?(user.workflow_state)
+ if enrollment.should_update_user_account_association? && !%w[creation_pending deleted].include?(user.workflow_state)
if enrollment.new_record? && !@update_account_association_user_ids.include?(user.id)
@incrementally_update_account_associations_user_ids.add(user.id)
else
@@ -447,8 +447,8 @@ module SIS
end
def enrollment_needs_due_date_recaching?(enrollment)
- unless %w(active inactive).include? enrollment.workflow_state_before_last_save
- return %w(active inactive).include? enrollment.workflow_state
+ unless %w[active inactive].include? enrollment.workflow_state_before_last_save
+ return %w[active inactive].include? enrollment.workflow_state
end
false
diff --git a/lib/sis/grade_publishing_results_importer.rb b/lib/sis/grade_publishing_results_importer.rb
index f5366e83a7e..d8005ba8acd 100644
--- a/lib/sis/grade_publishing_results_importer.rb
+++ b/lib/sis/grade_publishing_results_importer.rb
@@ -39,7 +39,7 @@ module SIS
def add_grade_publishing_result(enrollment_id, grade_publishing_status, message = nil)
raise ImportError, "No enrollment_id given" if enrollment_id.blank?
raise ImportError, "No grade_publishing_status given for enrollment #{enrollment_id}" if grade_publishing_status.blank?
- raise ImportError, "Improper grade_publishing_status \"#{grade_publishing_status}\" for enrollment #{enrollment_id}" unless %w{published error}.include?(grade_publishing_status.downcase)
+ raise ImportError, "Improper grade_publishing_status \"#{grade_publishing_status}\" for enrollment #{enrollment_id}" unless %w[published error].include?(grade_publishing_status.downcase)
if Enrollment.where(:id => enrollment_id, :root_account_id => @root_account)
.update_all(:grade_publishing_status => grade_publishing_status.downcase,
diff --git a/lib/sis/term_importer.rb b/lib/sis/term_importer.rb
index 1a23942b0e3..3bf035c2623 100644
--- a/lib/sis/term_importer.rb
+++ b/lib/sis/term_importer.rb
@@ -52,7 +52,7 @@ module SIS
if date_override_enrollment_type
# only configure the date override if this row is present
raise ImportError, "Cannot set date override on non-existent term" if term.new_record?
- unless %w(StudentEnrollment TeacherEnrollment TaEnrollment DesignerEnrollment).include?(date_override_enrollment_type)
+ unless %w[StudentEnrollment TeacherEnrollment TaEnrollment DesignerEnrollment].include?(date_override_enrollment_type)
raise ImportError, "Invalid date_override_enrollment_type"
end
diff --git a/lib/tasks/canvas.rake b/lib/tasks/canvas.rake
index 23a0d65b8e8..e6324ae7c15 100644
--- a/lib/tasks/canvas.rake
+++ b/lib/tasks/canvas.rake
@@ -217,7 +217,7 @@ unless $canvas_tasks_loaded
block.call(servers)
end
- %w{db:pending_migrations db:skipped_migrations db:migrate:predeploy db:migrate:tagged}.each do |task_name|
+ %w[db:pending_migrations db:skipped_migrations db:migrate:predeploy db:migrate:tagged].each do |task_name|
Switchman::Rake.shardify_task(task_name, categories: -> { Shard.categories })
end
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index 4b7d8ef3aa1..6a3983fc515 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -6,7 +6,7 @@ end
# enhancing these _after_ switchman conveniently means it will execute only once,
# not once per shard, and after the migrations have run
-%w{db:migrate db:migrate:predeploy db:migrate:up db:migrate:down db:rollback}.each do |task_name|
+%w[db:migrate db:migrate:predeploy db:migrate:up db:migrate:down db:rollback].each do |task_name|
Rake::Task[task_name].enhance do
MultiCache.delete("schema_cache")
end
diff --git a/lib/tasks/parallel_exclude.rb b/lib/tasks/parallel_exclude.rb
index d3e31297e0e..71d86236721 100644
--- a/lib/tasks/parallel_exclude.rb
+++ b/lib/tasks/parallel_exclude.rb
@@ -28,6 +28,6 @@ module Tasks::ParallelExclude
"spec/models/attachment_spec.rb"
].freeze
- test_files = FileList['{gems,vendor}/plugins/*/spec_canvas/**/*_spec.rb'].exclude(%r'spec_canvas/selenium') + FileList['spec/**/*_spec.rb'].exclude(%r'spec/selenium')
+ test_files = FileList['{gems,vendor}/plugins/*/spec_canvas/**/*_spec.rb'].exclude(%r{spec_canvas/selenium}) + FileList['spec/**/*_spec.rb'].exclude(%r{spec/selenium})
AVAILABLE_FILES = FILES.select { |file_name| test_files.include?(file_name) }
end
diff --git a/lib/tasks/remove_schema_sig.rake b/lib/tasks/remove_schema_sig.rake
index e3543f3bedc..7f5e9736e52 100644
--- a/lib/tasks/remove_schema_sig.rake
+++ b/lib/tasks/remove_schema_sig.rake
@@ -2,9 +2,9 @@
desc 'Removes the schema line in fixtures, models, and specs.'
task :remove_schema_signature do
- models = Dir.glob(File.join(File.dirname(__FILE__), %w(.. .. app models)) + "/*.rb")
- specs = Dir.glob(File.join(File.dirname(__FILE__), %w(.. .. spec models)) + "/*.rb")
- fixtures = Dir.glob(File.join(File.dirname(__FILE__), %w(.. .. spec fixtures)) + "/*.yml")
+ models = Dir.glob(File.join(File.dirname(__FILE__), %w[.. .. app models]) + "/*.rb")
+ specs = Dir.glob(File.join(File.dirname(__FILE__), %w[.. .. spec models]) + "/*.rb")
+ fixtures = Dir.glob(File.join(File.dirname(__FILE__), %w[.. .. spec fixtures]) + "/*.yml")
files = models | specs | fixtures
files.each { |file| remove_signature(file) }
end
diff --git a/lib/tasks/rspec.rake b/lib/tasks/rspec.rake
index f1572432377..146e59f5db7 100644
--- a/lib/tasks/rspec.rake
+++ b/lib/tasks/rspec.rake
@@ -45,9 +45,9 @@ unless Rails.env.production? || ARGV.any? { |a| a.start_with?('gems') }
# you can also do SPEC_OPTS='-e "test name"' but this is a little easier I
# suppose.
if ENV['SINGLE_TEST']
- t.spec_opts += ['-e', %{"#{ENV['SINGLE_TEST']}"}]
+ t.spec_opts += ['-e', %("#{ENV['SINGLE_TEST']}")]
end
- spec_files = FileList['{gems,vendor}/plugins/*/spec_canvas/**/*_spec.rb'].exclude(%r'spec_canvas/selenium') + FileList['spec/**/*_spec.rb'].exclude(%r'spec/selenium')
+ spec_files = FileList['{gems,vendor}/plugins/*/spec_canvas/**/*_spec.rb'].exclude(%r{spec_canvas/selenium}) + FileList['spec/**/*_spec.rb'].exclude(%r{spec/selenium})
Gem.loaded_specs.values.each do |spec|
path = spec.full_gem_path
spec_canvas_path = File.expand_path(path + "/spec_canvas")
@@ -118,7 +118,7 @@ unless Rails.env.production? || ARGV.any? { |a| a.start_with?('gems') }
desc "Run the code examples in {gems,vendor}/plugins (except RSpec's own)"
klass.new(:coverage) do |t|
t.spec_opts = ['--options', Shellwords.escape(Rails.root.join("spec/spec.opts"))]
- t.send(spec_files_attr, FileList['{gems,vendor}/plugins/*/spec_canvas/**/*_spec.rb'].exclude(%r'spec_canvas/selenium') + FileList['spec/**/*_spec.rb'].exclude(%r'spec/selenium'))
+ t.send(spec_files_attr, FileList['{gems,vendor}/plugins/*/spec_canvas/**/*_spec.rb'].exclude(%r{spec_canvas/selenium}) + FileList['spec/**/*_spec.rb'].exclude(%r{spec/selenium}))
end
namespace :plugins do
@@ -132,13 +132,13 @@ unless Rails.env.production? || ARGV.any? { |a| a.start_with?('gems') }
# Setup specs for stats
task :statsetup do
require 'rails/code_statistics'
- ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
- ::STATS_DIRECTORIES << %w(Service\ specs spec/services) if File.exist?('spec/services')
- ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
- ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
- ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
- ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
- ::STATS_DIRECTORIES << %w(Routing\ specs spec/lib) if File.exist?('spec/routing')
+ ::STATS_DIRECTORIES << %w[Model\ specs spec/models] if File.exist?('spec/models')
+ ::STATS_DIRECTORIES << %w[Service\ specs spec/services] if File.exist?('spec/services')
+ ::STATS_DIRECTORIES << %w[View\ specs spec/views] if File.exist?('spec/views')
+ ::STATS_DIRECTORIES << %w[Controller\ specs spec/controllers] if File.exist?('spec/controllers')
+ ::STATS_DIRECTORIES << %w[Helper\ specs spec/helpers] if File.exist?('spec/helpers')
+ ::STATS_DIRECTORIES << %w[Library\ specs spec/lib] if File.exist?('spec/lib')
+ ::STATS_DIRECTORIES << %w[Routing\ specs spec/lib] if File.exist?('spec/routing')
::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
::CodeStatistics::TEST_TYPES << "Service specs" if File.exist?('spec/services')
::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
diff --git a/lib/user_list_v2.rb b/lib/user_list_v2.rb
index 1b8ee15e60f..cb316fc2a93 100644
--- a/lib/user_list_v2.rb
+++ b/lib/user_list_v2.rb
@@ -31,7 +31,7 @@ class UserListV2
# - only search on particular columns
# - don't worry about whether we can create users or not: they either exist or they don't
- SEARCH_TYPES = %w{unique_id sis_user_id cc_path}.freeze
+ SEARCH_TYPES = %w[unique_id sis_user_id cc_path].freeze
def initialize(list_in, root_account: Account.default, search_type: nil, current_user: nil, can_read_sis: false)
@errors = []
diff --git a/lib/user_merge.rb b/lib/user_merge.rb
index 2f97b6783be..668e763ed30 100644
--- a/lib/user_merge.rb
+++ b/lib/user_merge.rb
@@ -128,10 +128,10 @@ class UserMerge
Attachment.delay.migrate_attachments(from_user, target_user)
updates = {}
- %w(access_tokens asset_user_accesses calendar_events collaborations
+ %w[access_tokens asset_user_accesses calendar_events collaborations
context_module_progressions group_memberships ignores
page_comments Polling::Poll rubric_assessments user_services
- web_conference_participants web_conferences wiki_pages).each do |key|
+ web_conference_participants web_conferences wiki_pages].each do |key|
updates[key] = "user_id"
end
updates['submission_comments'] = 'author_id'
@@ -202,7 +202,7 @@ class UserMerge
return from_user.preferences if from_user.shard == target_user.shard
preferences = from_user.preferences.dup
- %i{custom_colors course_nicknames}.each do |pref|
+ %i[custom_colors course_nicknames].each do |pref|
preferences.delete(pref)
new_pref = {}
from_user.preferences[pref]&.each do |key, value|
diff --git a/script/linter.rb b/script/linter.rb
index e1f4816385e..5d9e6346b4b 100644
--- a/script/linter.rb
+++ b/script/linter.rb
@@ -89,7 +89,7 @@ class Linter
def severe_levels
return @severe_levels if @severe_levels
- boyscout_mode ? %w(info warn error fatal) : %w(warn error fatal)
+ boyscout_mode ? %w[info warn error fatal] : %w[warn error fatal]
end
private
diff --git a/spec/apis/api_spec_helper.rb b/spec/apis/api_spec_helper.rb
index 876e2b24564..ff3c914b036 100644
--- a/spec/apis/api_spec_helper.rb
+++ b/spec/apis/api_spec_helper.rb
@@ -164,7 +164,7 @@ end
# response from the api for that field, which will be verified for correctness.
def should_translate_user_content(course, include_verifiers = true)
attachment = attachment_model(:context => course)
- content = %{
+ content = <<~HTML
Hello, students.
This will explain everything:
@@ -173,7 +173,7 @@ def should_translate_user_content(course, include_verifiers = true)
Also, watch this awesome video:
And refer to this awesome wiki page.
- }
+ HTML
html = yield content
check_document(html, course, attachment, include_verifiers)
diff --git a/spec/apis/auth_spec.rb b/spec/apis/auth_spec.rb
index ffa83246aa2..0aa56054701 100644
--- a/spec/apis/auth_spec.rb
+++ b/spec/apis/auth_spec.rb
@@ -633,7 +633,7 @@ describe "API Authentication", type: :request do
auth_header = { 'HTTP_AUTHORIZATION' => "Bearer #{expired_services_jwt}" }
get "/api/v1/courses", headers: auth_header
assert_status(401)
- expect(response['WWW-Authenticate']).to eq %{Bearer realm="canvas-lms"}
+ expect(response['WWW-Authenticate']).to eq %(Bearer realm="canvas-lms")
end
it "requires an active pseudonym" do
@@ -711,25 +711,25 @@ describe "API Authentication", type: :request do
it "errors if the access token is expired or non-existent" do
get "/api/v1/courses", headers: { 'HTTP_AUTHORIZATION' => "Bearer blahblah" }
assert_status(401)
- expect(response['WWW-Authenticate']).to eq %{Bearer realm="canvas-lms"}
+ expect(response['WWW-Authenticate']).to eq %(Bearer realm="canvas-lms")
@token.update_attribute(:expires_at, 1.hour.ago)
get "/api/v1/courses", headers: { 'HTTP_AUTHORIZATION' => "Bearer #{@token.full_token}" }
assert_status(401)
- expect(response['WWW-Authenticate']).to eq %{Bearer realm="canvas-lms"}
+ expect(response['WWW-Authenticate']).to eq %(Bearer realm="canvas-lms")
end
it "errors if the developer key is inactive" do
@token.developer_key.deactivate!
get "/api/v1/courses", headers: { 'HTTP_AUTHORIZATION' => "Bearer #{@token.full_token}" }
assert_status(401)
- expect(response['WWW-Authenticate']).to eq %{Bearer realm="canvas-lms"}
+ expect(response['WWW-Authenticate']).to eq %(Bearer realm="canvas-lms")
end
it "requires an active pseudonym for the access token user" do
@user.pseudonym.destroy
get "/api/v1/courses", headers: { 'HTTP_AUTHORIZATION' => "Bearer #{@token.full_token}" }
assert_status(401)
- expect(response['WWW-Authenticate']).to eq %{Bearer realm="canvas-lms"}
+ expect(response['WWW-Authenticate']).to eq %(Bearer realm="canvas-lms")
json = JSON.parse(response.body)
expect(json['errors'].first['message']).to eq "Invalid access token."
end
@@ -737,7 +737,7 @@ describe "API Authentication", type: :request do
it "errors if no access token is given and authorization is required" do
get "/api/v1/courses"
assert_status(401)
- expect(response['WWW-Authenticate']).to eq %{Bearer realm="canvas-lms"}
+ expect(response['WWW-Authenticate']).to eq %(Bearer realm="canvas-lms")
json = json_parse
expect(json["errors"].first["message"]).to eq "user authorization required"
end
diff --git a/spec/apis/file_uploads_spec_helper.rb b/spec/apis/file_uploads_spec_helper.rb
index a8c8a26d4e4..de05a18e8ec 100644
--- a/spec/apis/file_uploads_spec_helper.rb
+++ b/spec/apis/file_uploads_spec_helper.rb
@@ -170,7 +170,7 @@ shared_examples_for "file uploads api" do
expect(response).to be_successful
attachment.reload
json = json_parse(response.body)
- expect(json).to eq attachment_json(attachment, { include: %w(enhanced_preview_url) })
+ expect(json).to eq attachment_json(attachment, { include: %w[enhanced_preview_url] })
expect(attachment.file_state).to eq 'available'
expect(attachment.content_type).to eq "application/msword"
diff --git a/spec/apis/general_api_spec.rb b/spec/apis/general_api_spec.rb
index e9e3237e25a..1de009e0e89 100644
--- a/spec/apis/general_api_spec.rb
+++ b/spec/apis/general_api_spec.rb
@@ -36,7 +36,7 @@ describe "API", type: :request do
it "skips attribute filtering if obj doesn't respond" do
course_with_teacher
expect(@course.respond_to?(:filter_attributes_for_user)).to be_truthy
- expect(@course.as_json(:include_root => false, :permissions => { :user => @user }, :only => %w(name sis_source_id)).keys.sort).to eq %w(name permissions sis_source_id)
+ expect(@course.as_json(:include_root => false, :permissions => { :user => @user }, :only => %w[name sis_source_id]).keys.sort).to eq %w[name permissions sis_source_id]
end
it "does attribute filtering if obj responds" do
@@ -47,19 +47,19 @@ describe "API", type: :request do
expect(session).to be_nil
hash.delete('sis_source_id')
end
- expect(@course.as_json(:include_root => false, :permissions => { :user => @user }, :only => %w(name sis_source_id)).keys.sort).to eq %w(name permissions)
+ expect(@course.as_json(:include_root => false, :permissions => { :user => @user }, :only => %w[name sis_source_id]).keys.sort).to eq %w[name permissions]
end
it "does not return the permissions list if include_permissions is false" do
course_with_teacher
- expect(@course.as_json(:include_root => false, :permissions => { :user => @user, :include_permissions => false }, :only => %w(name sis_source_id)).keys.sort).to eq %w(name sis_source_id)
+ expect(@course.as_json(:include_root => false, :permissions => { :user => @user, :include_permissions => false }, :only => %w[name sis_source_id]).keys.sort).to eq %w[name sis_source_id]
end
it "serializes permissions if obj responds" do
course_with_teacher
expect(@course).to receive(:serialize_permissions).once.with(anything, @teacher, nil)
- json = @course.as_json(:include_root => false, :permissions => { :user => @user, :session => nil, :include_permissions => true, :policies => ["update"] }, :only => %w(name))
- expect(json.keys.sort).to eq %w(name permissions)
+ json = @course.as_json(:include_root => false, :permissions => { :user => @user, :session => nil, :include_permissions => true, :policies => ["update"] }, :only => %w[name])
+ expect(json.keys.sort).to eq %w[name permissions]
end
end
diff --git a/spec/apis/locked_spec.rb b/spec/apis/locked_spec.rb
index 7d3c64e05e6..9ed7791ab57 100644
--- a/spec/apis/locked_spec.rb
+++ b/spec/apis/locked_spec.rb
@@ -27,10 +27,10 @@ shared_examples_for 'a locked api item' do
end
def verify_locked(*lock_info_extra)
- prohibited_fields = %w(
+ prohibited_fields = %w[
canvadoc_session_url
crocodoc_session_url
- )
+ ]
json = api_get_json
diff --git a/spec/apis/lti/lti2_api_spec_helper.rb b/spec/apis/lti/lti2_api_spec_helper.rb
index c613b7098a8..26a4024de00 100644
--- a/spec/apis/lti/lti2_api_spec_helper.rb
+++ b/spec/apis/lti/lti2_api_spec_helper.rb
@@ -40,7 +40,7 @@ RSpec.shared_context "lti2_api_spec_helper", :shared_context => :metadata do
let(:raw_data) do
rsp = ::IMS::LTI::Models::RestServiceProfile.new(
service: "http://example.com/endpoint##{service_name}",
- action: %w(get put delete post)
+ action: %w[get put delete post]
)
ims_tp = ::IMS::LTI::Models::ToolProxy.new
security_contract = ::IMS::LTI::Models::SecurityContract.new(tool_service: rsp)
diff --git a/spec/apis/lti/lti_app_api_spec.rb b/spec/apis/lti/lti_app_api_spec.rb
index 0ea9e98d96b..7a3facd19bb 100644
--- a/spec/apis/lti/lti_app_api_spec.rb
+++ b/spec/apis/lti/lti_app_api_spec.rb
@@ -43,7 +43,7 @@ module Lti
course_with_teacher(active_all: true, user: user_with_pseudonym, account: account)
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
{ controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json',
- placements: %w(resource_selection), course_id: @course.id.to_s })
+ placements: %w[resource_selection], course_id: @course.id.to_s })
expect(json.detect { |j| j['definition_type'] == resource_tool.class.name && j['definition_id'] == resource_tool.id }).not_to be_nil
expect(json.detect { |j| j['definition_type'] == @external_tool.class.name && j['definition_id'] == @external_tool.id }).to be_nil
end
@@ -73,7 +73,7 @@ module Lti
resource_tool.settings[:resource_selection][:visibility] = 'admins'
resource_tool.save!
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w(resource_selection) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w[resource_selection] })
expect(response.status).to eq 200
expect(json.count).to eq 0
@@ -85,7 +85,7 @@ module Lti
resource_tool.settings[:resource_selection][:visibility] = 'members'
resource_tool.save!
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w(resource_selection) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w[resource_selection] })
expect(response.status).to eq 200
expect(json.count).to eq 1
@@ -98,7 +98,7 @@ module Lti
resource_tool.settings[:resource_selection][:visibility] = 'public'
resource_tool.save!
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w(resource_selection) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w[resource_selection] })
expect(response.status).to eq 200
expect(json.count).to eq 1
@@ -109,7 +109,7 @@ module Lti
course_with_student(active_all: true, user: user_with_pseudonym, account: account)
resource_tool = new_valid_external_tool(account, true)
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w(resource_selection) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w[resource_selection] })
expect(response.status).to eq 200
expect(json.count).to eq 1
@@ -122,7 +122,7 @@ module Lti
resource_tool.settings[:resource_selection][:visibility] = 'public'
resource_tool.save!
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w(resource_selection) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w[resource_selection] })
expect(response.status).to eq 200
expect(json.count).to eq 1
@@ -131,7 +131,7 @@ module Lti
it 'cannot get the definition of public stuff at the account level' do
api_call(:get, "/api/v1/accounts/self/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', account_id: 'self', placements: %w(global_navigation) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', account_id: 'self', placements: %w[global_navigation] })
expect(response.status).to eq 401
end
@@ -141,7 +141,7 @@ module Lti
resource_tool.settings[:resource_selection][:visibility] = 'members'
resource_tool.save!
json = api_call(:get, "/api/v1/courses/#{@course.id}/lti_apps/launch_definitions",
- { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w(resource_selection) })
+ { controller: 'lti/lti_apps', action: 'launch_definitions', format: 'json', course_id: @course.id.to_s, placements: %w[resource_selection] })
expect(response.status).to eq 200
expect(json.count).to eq 0
diff --git a/spec/apis/lti/subscriptions_api_spec.rb b/spec/apis/lti/subscriptions_api_spec.rb
index f5bc8327135..03598857296 100644
--- a/spec/apis/lti/subscriptions_api_spec.rb
+++ b/spec/apis/lti/subscriptions_api_spec.rb
@@ -62,7 +62,7 @@ module Lti
end
it 'creates subscriptions' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
post create_endpoint, params: { subscription: subscription }, headers: request_headers
expect(response).to be_successful
@@ -80,7 +80,7 @@ module Lti
it 'renders 401 if Lti::ToolProxy#active_in_context? does not return true' do
allow_any_instance_of(Lti::ToolProxy).to receive(:active_in_context?).with(an_instance_of(Account)).and_return(false)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
post create_endpoint, params: { subscription: subscription }, headers: request_headers
expect(response).to be_unauthorized
@@ -88,14 +88,14 @@ module Lti
it 'gives error message if Lti::ToolProxy#active_in_context? does not return true' do
allow_any_instance_of(Lti::ToolProxy).to receive(:active_in_context?).with(an_instance_of(Account)).and_return(false)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
post create_endpoint, params: { subscription: subscription }, headers: request_headers
expect(JSON.parse(response.body)['error']).to eq 'Unauthorized subscription'
end
it 'requires JWT Access token' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
post create_endpoint, params: { subscription: subscription }
expect(response).to be_unauthorized
@@ -103,7 +103,7 @@ module Lti
it 'gives 500 if the subscription service is not configured' do
allow(subscription_service).to receive_messages(available?: false)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
post create_endpoint, params: { subscription: subscription }, headers: request_headers
expect(response.status).to eq 500
@@ -111,7 +111,7 @@ module Lti
it 'gives useful message if the subscription service is not configured' do
allow(subscription_service).to receive_messages(available?: false)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
post create_endpoint, params: { subscription: subscription }, headers: request_headers
expect(JSON.parse(response.body)['error']).to eq 'Subscription service not configured'
@@ -121,7 +121,7 @@ module Lti
describe '#destroy' do
before do
allow(subscription_service).to receive_messages(destroy_tool_proxy_subscription: delete_response)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
end
@@ -159,7 +159,7 @@ module Lti
describe '#show' do
before do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
end
@@ -198,7 +198,7 @@ module Lti
describe '#update' do
before do
allow(subscription_service).to receive_messages(update_tool_proxy_subscription: ok_response)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
end
@@ -229,7 +229,7 @@ module Lti
it 'renders 401 if Lti::ToolProxy#active_in_context? does not return true' do
allow_any_instance_of(Lti::ToolProxy).to receive(:active_in_context?).with(an_instance_of(Account)).and_return(false)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
put update_endpoint, params: { subscription: subscription }, headers: request_headers
expect(response).to be_unauthorized
@@ -237,7 +237,7 @@ module Lti
it 'gives error message if Lti::ToolProxy#active_in_context? does not return true' do
allow_any_instance_of(Lti::ToolProxy).to receive(:active_in_context?).with(an_instance_of(Account)).and_return(false)
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
put update_endpoint, params: { subscription: subscription }, headers: request_headers
expect(JSON.parse(response.body)['error']).to eq 'Unauthorized subscription'
@@ -263,7 +263,7 @@ module Lti
describe '#index' do
before do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
tool_proxy.save!
end
diff --git a/spec/apis/lti/subscriptions_validator_spec.rb b/spec/apis/lti/subscriptions_validator_spec.rb
index b6f59ddb6a5..529675ec6db 100644
--- a/spec/apis/lti/subscriptions_validator_spec.rb
+++ b/spec/apis/lti/subscriptions_validator_spec.rb
@@ -90,13 +90,13 @@ module Lti
end
it 'allows subscription if vnd.instructure.webhooks.assignment.quiz_submitted enabled' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.quiz_submitted)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.quiz_submitted]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.not_to raise_error
end
it 'raises MissingCapability if missing capabilities' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.submission_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.submission_created]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.to raise_error SubscriptionsValidator::MissingCapability
end
@@ -134,7 +134,7 @@ module Lti
end
it 'raises MissingCapability if missing capabilities' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.quiz_submitted)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.quiz_submitted]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.to raise_error SubscriptionsValidator::MissingCapability
end
@@ -172,13 +172,13 @@ module Lti
end
it 'allows subscription if vnd.instructure.webhooks.assignment.attachment_created' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.attachment_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.attachment_created]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.not_to raise_error
end
it 'raises MissingCapability if missing capabilities' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.quiz_submitted)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.quiz_submitted]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.to raise_error SubscriptionsValidator::MissingCapability
end
@@ -216,13 +216,13 @@ module Lti
end
it 'allows subscription if vnd.instructure.webhooks.assignment.submission_created' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.submission_created)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.submission_created]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.not_to raise_error
end
it 'raises MissingCapability if missing capabilities' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.quiz_submitted)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.quiz_submitted]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.to raise_error SubscriptionsValidator::MissingCapability
end
@@ -260,13 +260,13 @@ module Lti
end
it 'allows subscription if vnd.instructure.webhooks.assignment.submission_updated' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.submission_updated)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.submission_updated]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.not_to raise_error
end
it 'raises MissingCapability if missing capabilities' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.quiz_submitted)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.quiz_submitted]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.to raise_error SubscriptionsValidator::MissingCapability
end
@@ -304,13 +304,13 @@ module Lti
end
it 'allows subscription if vnd.instructure.webhooks.assignment.submission_created' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.plagiarism_resubmit)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.plagiarism_resubmit]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.not_to raise_error
end
it 'raises MissingCapability if missing capabilities' do
- tool_proxy[:raw_data]['enabled_capability'] = %w(vnd.instructure.webhooks.assignment.quiz_submitted)
+ tool_proxy[:raw_data]['enabled_capability'] = %w[vnd.instructure.webhooks.assignment.quiz_submitted]
validator = SubscriptionsValidator.new(subscription, tool_proxy)
expect { validator.check_required_capabilities! }.to raise_error SubscriptionsValidator::MissingCapability
end
diff --git a/spec/apis/lti/users_api_spec.rb b/spec/apis/lti/users_api_spec.rb
index 63b8bf0efac..6316203a214 100644
--- a/spec/apis/lti/users_api_spec.rb
+++ b/spec/apis/lti/users_api_spec.rb
@@ -176,7 +176,7 @@ module Lti
get group_index_endpoint, headers: request_headers
parsed_body = JSON.parse(response.body)
expected_json = group.users.map do |user|
- user_json(user, user, nil, [], group.context, tool_includes: %w(email lti_id))
+ user_json(user, user, nil, [], group.context, tool_includes: %w[email lti_id])
end
expect(parsed_body.sort_by { |u| u[:id] }).to eq(expected_json.sort_by { |u| u[:id] })
end
@@ -210,7 +210,7 @@ module Lti
get group_index_endpoint, headers: request_headers
parsed_body = JSON.parse(response.body)
expected_json = group.users.map do |user|
- user_json(user, user, nil, [], group.context, tool_includes: %w(email lti_id))
+ user_json(user, user, nil, [], group.context, tool_includes: %w[email lti_id])
end
expect(parsed_body.sort_by { |u| u[:id] }).to eq(expected_json.sort_by { |u| u[:id] })
end
diff --git a/spec/apis/swagger/argument_view_spec.rb b/spec/apis/swagger/argument_view_spec.rb
index 920a03ea557..c94574dd213 100644
--- a/spec/apis/swagger/argument_view_spec.rb
+++ b/spec/apis/swagger/argument_view_spec.rb
@@ -78,7 +78,7 @@ describe ArgumentView do
end
context "with types, enums, description" do
- let(:view) { ArgumentView.new %{arg [Optional, String, "val1"|"val2"] argument} }
+ let(:view) { ArgumentView.new %(arg [Optional, String, "val1"|"val2"] argument) }
it "has enums" do
expect(view.enums).to eq ["val1", "val2"]
@@ -94,7 +94,7 @@ describe ArgumentView do
end
context "with optional arg" do
- let(:view) { ArgumentView.new %{arg [String]} }
+ let(:view) { ArgumentView.new %(arg [String]) }
it "is optional" do
expect(view.optional?).to be_truthy
@@ -102,7 +102,7 @@ describe ArgumentView do
end
context "with required arg" do
- let(:view) { ArgumentView.new %{arg [Required, String]} }
+ let(:view) { ArgumentView.new %(arg [Required, String]) }
it "is required" do
expect(view.required?).to be_truthy
diff --git a/spec/apis/user_content_spec.rb b/spec/apis/user_content_spec.rb
index c2b5567487e..cbafb948ba7 100644
--- a/spec/apis/user_content_spec.rb
+++ b/spec/apis/user_content_spec.rb
@@ -363,7 +363,7 @@ describe UserContent, type: :request do
"http://www.example.com/api/v1/users/#{@teacher.id}/files/789"
]
expect(doc.css('a').collect { |att| att['data-api-returntype'] }).to eq(
- %w(Folder File)
+ %w[Folder File]
)
end
end
@@ -426,7 +426,7 @@ describe UserContent, type: :request do
end
def confirm_url_stability(url)
- link = %Q{what}
+ link = %Q(what)
html = tester.process_incoming_html_content(link)
doc = Nokogiri::HTML5.fragment(html)
expect(doc.at_css('a')['href']).to eq url
@@ -450,7 +450,7 @@ describe UserContent, type: :request do
end
def confirm_url_stability(url)
- link = %Q{whata>}
+ link = %Q(whata>)
html = tester.process_incoming_html_content(link)
doc = Nokogiri::HTML5.fragment(html)
expect(doc.at_css('a')['href']).to eq url
@@ -493,7 +493,7 @@ describe UserContent, type: :request do
describe "latex_to_mathml" do
it "returns mathml on success" do
valid_latex = '\frac{a}{b}'
- expect(UserContent.latex_to_mathml(valid_latex)).to eql(%{})
+ expect(UserContent.latex_to_mathml(valid_latex)).to eql(%())
end
it "returns empty string on parse error" do
diff --git a/spec/apis/v1/account_notifications_api_spec.rb b/spec/apis/v1/account_notifications_api_spec.rb
index 960dc2b6fee..fa434774d72 100644
--- a/spec/apis/v1/account_notifications_api_spec.rb
+++ b/spec/apis/v1/account_notifications_api_spec.rb
@@ -44,7 +44,7 @@ describe 'Account Notification API', type: :request do
second_announcement
json = api_call(:get, @path, @api_params,)
expect(json.length).to eq 2
- expect(json.map { |r| r["message"] }).to match_array(%w{default second})
+ expect(json.map { |r| r["message"] }).to match_array(%w[default second])
end
it "still works on the old endpoint" do
@@ -55,7 +55,7 @@ describe 'Account Notification API', type: :request do
user_id: @admin.id.to_s,
account_id: @admin.account.id.to_s
})
- expect(json.map { |r| r["message"] }).to eq %w{default}
+ expect(json.map { |r| r["message"] }).to eq %w[default]
end
it "catches a user_id mismatch on the old endpoint" do
diff --git a/spec/apis/v1/account_reports_api_spec.rb b/spec/apis/v1/account_reports_api_spec.rb
index eecbd320ca7..302273b1388 100644
--- a/spec/apis/v1/account_reports_api_spec.rb
+++ b/spec/apis/v1/account_reports_api_spec.rb
@@ -61,7 +61,7 @@ describe 'Account Reports API', type: :request do
report = api_call(:post, "/api/v1/accounts/#{@admin.account.id}/reports/#{@report.report_type}",
{ report: @report.report_type, controller: 'account_reports', action: 'create',
format: 'json', account_id: @admin.account.id.to_s })
- keys = %w(id progress parameters current_line status report created_at started_at ended_at file_url)
+ keys = %w[id progress parameters current_line status report created_at started_at ended_at file_url]
expect(report['status']).to eq 'created'
expect(keys - report.keys).to be_empty
end
diff --git a/spec/apis/v1/accounts_api_spec.rb b/spec/apis/v1/accounts_api_spec.rb
index 3dc35b723a1..9439a77cbf0 100644
--- a/spec/apis/v1/accounts_api_spec.rb
+++ b/spec/apis/v1/accounts_api_spec.rb
@@ -1605,28 +1605,28 @@ describe "Accounts API", type: :request do
json = api_call(:get, "/api/v1/accounts/#{@a.id}/courses?blueprint=true",
{ :controller => 'accounts', :action => 'courses_api', :account_id => @a.to_param,
:format => 'json', :blueprint => true })
- expect(json.map { |c| c['name'] }).to match_array %w(MasterCourse)
+ expect(json.map { |c| c['name'] }).to match_array %w[MasterCourse]
end
it 'filters out blueprint courses' do
json = api_call(:get, "/api/v1/accounts/#{@a.id}/courses?blueprint=false",
{ :controller => 'accounts', :action => 'courses_api', :account_id => @a.to_param,
:format => 'json', :blueprint => false })
- expect(json.map { |c| c['name'] }).to match_array %w(ChildCourse OtherCourse)
+ expect(json.map { |c| c['name'] }).to match_array %w[ChildCourse OtherCourse]
end
it 'filters in associated courses' do
json = api_call(:get, "/api/v1/accounts/#{@a.id}/courses?blueprint_associated=true",
{ :controller => 'accounts', :action => 'courses_api', :account_id => @a.to_param,
:format => 'json', :blueprint_associated => true })
- expect(json.map { |c| c['name'] }).to match_array %w(ChildCourse)
+ expect(json.map { |c| c['name'] }).to match_array %w[ChildCourse]
end
it 'filters out associated courses' do
json = api_call(:get, "/api/v1/accounts/#{@a.id}/courses?blueprint_associated=false",
{ :controller => 'accounts', :action => 'courses_api', :account_id => @a.to_param,
:format => 'json', :blueprint_associated => false })
- expect(json.map { |c| c['name'] }).to match_array %w(MasterCourse OtherCourse)
+ expect(json.map { |c| c['name'] }).to match_array %w[MasterCourse OtherCourse]
end
end
end
@@ -1635,14 +1635,14 @@ describe "Accounts API", type: :request do
it "returns permissions" do
json = api_call(:get, "/api/v1/accounts/#{@a1.id}/permissions?permissions[]=become_user&permissions[]=manage_blarghs",
:controller => 'accounts', :action => 'permissions', :account_id => @a1.to_param,
- :format => 'json', :permissions => %w(become_user manage_blarghs))
+ :format => 'json', :permissions => %w[become_user manage_blarghs])
expect(json).to eq({ "become_user" => true, "manage_blarghs" => false })
end
it "requires :read permission on the account" do
api_call(:get, "/api/v1/accounts/#{@a3.id}/permissions?permissions[]=become_user",
{ :controller => 'accounts', :action => 'permissions', :account_id => @a3.to_param, :format => 'json',
- :permissions => %w(become_user) }, {}, {}, { :expected_status => 401 })
+ :permissions => %w[become_user] }, {}, {}, { :expected_status => 401 })
end
end
diff --git a/spec/apis/v1/assignments_api_spec.rb b/spec/apis/v1/assignments_api_spec.rb
index 34bec4a204b..5e2fcc3f9e7 100644
--- a/spec/apis/v1/assignments_api_spec.rb
+++ b/spec/apis/v1/assignments_api_spec.rb
@@ -195,28 +195,28 @@ describe AssignmentsApiController, type: :request do
# [assignment_groups.position, assignments.position]
json = api_get_assignments_index_from_course(@course)
order = json.map { |a| a['name'] }
- expect(order).to eq %w(assignment2
+ expect(order).to eq %w[assignment2
assignment1
assignment6
assignment3
assignment5
assignment8
assignment7
- assignment4)
+ assignment4]
end
it 'only returns post_to_sis assignments' do
Assignment.where(assignment_group_id: [@group1, @group2]).update_all(post_to_sis: true)
json = api_get_assignments_index_from_course(@course, post_to_sis: true)
post_to_sis = json.map { |a| a['name'] }
- expect(post_to_sis).to eq %w(assignment2 assignment1 assignment6 assignment3 assignment5)
+ expect(post_to_sis).to eq %w[assignment2 assignment1 assignment6 assignment3 assignment5]
end
it 'only returns assignments that do not have post_to_sis' do
Assignment.where(assignment_group_id: [@group1, @group2]).update_all(post_to_sis: true)
json = api_get_assignments_index_from_course(@course, post_to_sis: false)
post_to_sis = json.map { |a| a['name'] }
- expect(post_to_sis).to eq %w(assignment8 assignment7 assignment4)
+ expect(post_to_sis).to eq %w[assignment8 assignment7 assignment4]
end
it 'fails for post_to_sis assignments when user cannot manage assignments' do
@@ -239,14 +239,14 @@ describe AssignmentsApiController, type: :request do
# [assignment_groups.position, assignments.position]
json = api_get_assignments_index_from_course(@course, order_by: 'name')
order = json.map { |a| a['name'] }
- expect(order).to eq %w(assignment1
+ expect(order).to eq %w[assignment1
assignment2
assignment3
assignment4
assignment5
assignment6
assignment7
- assignment8)
+ assignment8]
end
context 'by due date' do
@@ -258,7 +258,7 @@ describe AssignmentsApiController, type: :request do
@student2 = student_in_course(name: 'student2', active_all: true, section: @section2).user
due_at = 1.month.ago
- @course.assignments.where(title: %w(assignment1 assignment4 assignment7)).each do |a|
+ @course.assignments.where(title: %w[assignment1 assignment4 assignment7]).each do |a|
a.due_at = due_at
a.save!
end
@@ -267,7 +267,7 @@ describe AssignmentsApiController, type: :request do
due_at: 2.months.from_now)
due_at = 1.month.from_now
- @course.assignments.where(title: %w(assignment2 assignment3 assignment5)).each do |a|
+ @course.assignments.where(title: %w[assignment2 assignment3 assignment5]).each do |a|
a.due_at = due_at
a.save!
end
@@ -283,19 +283,19 @@ describe AssignmentsApiController, type: :request do
it "sorts the returned list of assignments by latest due date for teachers (nulls last)" do
json = api_get_assignments_user_index(@teacher, @course, @teacher, order_by: 'due_at')
- order = %w(assignment1 assignment7 assignment2 assignment5 assignment4 assignment3 assignment6 assignment8)
+ order = %w[assignment1 assignment7 assignment2 assignment5 assignment4 assignment3 assignment6 assignment8]
expect(json.map { |a| a['name'] }).to eq order
expect(json.sort_by { |a| [a['due_at'] || CanvasSort::Last, a['name']] }.map { |a| a['name'] }).to eq order
end
it "sorts the returned list of assignments by overridden due date for students (nulls last)" do
json = api_get_assignments_user_index(@student1, @course, @teacher, order_by: 'due_at')
- order = %w(assignment1 assignment7 assignment2 assignment3 assignment5 assignment4 assignment6 assignment8)
+ order = %w[assignment1 assignment7 assignment2 assignment3 assignment5 assignment4 assignment6 assignment8]
expect(json.map { |a| a['name'] }).to eq order
expect(json.sort_by { |a| [a['due_at'] || CanvasSort::Last, a['name']] }.map { |a| a['name'] }).to eq order
json = api_get_assignments_user_index(@student2, @course, @teacher, order_by: 'due_at')
- order = %w(assignment3 assignment1 assignment4 assignment7 assignment2 assignment5 assignment6 assignment8)
+ order = %w[assignment3 assignment1 assignment4 assignment7 assignment2 assignment5 assignment6 assignment8]
expect(json.map { |a| a['name'] }).to eq order
expect(json.sort_by { |a| [a['due_at'] || CanvasSort::Last, a['name']] }.map { |a| a['name'] }).to eq order
end
@@ -5939,7 +5939,7 @@ describe AssignmentsApiController, type: :request do
end
it "does not update integration_data when lacking permission" do
- json = %{{"key": "value"}}
+ json = %({"key": "value"})
params = ActionController::Parameters.new({ "integration_data" => json })
update_from_params(@assignment, params, @user)
@@ -5947,7 +5947,7 @@ describe AssignmentsApiController, type: :request do
end
it "updates integration_data with permission" do
- json = %{{"key": "value"}}
+ json = %({"key": "value"})
params = ActionController::Parameters.new({ "integration_data" => json })
account_admin_user_with_role_changes(
:role_changes => { :manage_sis => true }
@@ -6613,7 +6613,7 @@ describe AssignmentsApiController, type: :request do
end
it "sets can_edit on each date if requested" do
- json = api_get_assignments_index_from_course(@course, include: %w(all_dates can_edit))
+ json = api_get_assignments_index_from_course(@course, include: %w[all_dates can_edit])
a0_json = json.detect { |a| a['id'] == @a0.id }
expect(a0_json['can_edit']).to eq true
expect(a0_json['all_dates'].map { |d| d['can_edit'] }).to eq [true]
@@ -6638,7 +6638,7 @@ describe AssignmentsApiController, type: :request do
it "allows account admins to edit whatever they want" do
account_admin_user
- json = api_get_assignments_index_from_course(@course, include: %w(all_dates can_edit))
+ json = api_get_assignments_index_from_course(@course, include: %w[all_dates can_edit])
a0_json = json.detect { |a| a['id'] == @a0.id }
expect(a0_json['can_edit']).to eq true
expect(a0_json['all_dates'].map { |d| d['can_edit'] }).to eq [true]
@@ -6679,7 +6679,7 @@ describe AssignmentsApiController, type: :request do
end
it "sets can_edit on each date if requested" do
- json = api_get_assignments_index_from_course(@course, include: %w(all_dates can_edit))
+ json = api_get_assignments_index_from_course(@course, include: %w[all_dates can_edit])
a0_json = json.detect { |a| a['id'] == @a0.id }
expect(a0_json['can_edit']).to eq false
diff --git a/spec/apis/v1/authentication_audit_api_spec.rb b/spec/apis/v1/authentication_audit_api_spec.rb
index e7f9fa86a09..4f50c63011c 100644
--- a/spec/apis/v1/authentication_audit_api_spec.rb
+++ b/spec/apis/v1/authentication_audit_api_spec.rb
@@ -109,7 +109,7 @@ describe "AuthenticationAudit API", type: :request do
end
it "has correct root keys" do
- expect(@json.keys.sort).to eq %w{events linked links}
+ expect(@json.keys.sort).to eq %w[events linked links]
end
it "has a formatted links key" do
@@ -123,7 +123,7 @@ describe "AuthenticationAudit API", type: :request do
end
it "has a formatted linked key" do
- expect(@json['linked'].keys.sort).to eq %w{accounts logins page_views users}
+ expect(@json['linked'].keys.sort).to eq %w[accounts logins page_views users]
expect(@json['linked']['accounts'].is_a?(Array)).to be_truthy
expect(@json['linked']['logins'].is_a?(Array)).to be_truthy
expect(@json['linked']['page_views'].is_a?(Array)).to be_truthy
diff --git a/spec/apis/v1/collaborations_api_spec.rb b/spec/apis/v1/collaborations_api_spec.rb
index e853c7373e2..4a072087b2e 100644
--- a/spec/apis/v1/collaborations_api_spec.rb
+++ b/spec/apis/v1/collaborations_api_spec.rb
@@ -159,7 +159,7 @@ describe CollaborationsController, type: :request do
it 'is formatted by collaborator_json' do
json = api_call(:get, url, url_options)
- expect(json.first.keys.sort).to eq %w{collaborator_id id name type}
+ expect(json.first.keys.sort).to eq %w[collaborator_id id name type]
end
it 'includes groups' do
diff --git a/spec/apis/v1/content_exports_api_spec.rb b/spec/apis/v1/content_exports_api_spec.rb
index f1be64ddcc4..31128e97314 100644
--- a/spec/apis/v1/content_exports_api_spec.rb
+++ b/spec/apis/v1/content_exports_api_spec.rb
@@ -777,8 +777,8 @@ describe ContentExportsApiController, type: :request do
expect(export.attachment.display_name).to eql 'course_files_export.zip'
tf = export.attachment.open need_local_file: true
Zip::File.open(tf) do |zf|
- expect(zf.entries.select { |entry| entry.ftype == :file }.map(&:name)).to match_array %w(file1.txt hidden.txt teh_folder/file2.txt)
- expect(zf.entries.select { |entry| entry.ftype == :directory }.map(&:name)).to match_array %w(teh_folder/ teh_folder/empty_folder/)
+ expect(zf.entries.select { |entry| entry.ftype == :file }.map(&:name)).to match_array %w[file1.txt hidden.txt teh_folder/file2.txt]
+ expect(zf.entries.select { |entry| entry.ftype == :directory }.map(&:name)).to match_array %w[teh_folder/ teh_folder/empty_folder/]
end
end
@@ -794,7 +794,7 @@ describe ContentExportsApiController, type: :request do
expect(export.attachment.display_name).to eql 'course_files_export.zip'
tf = export.attachment.open need_local_file: true
Zip::File.open(tf) do |zf|
- expect(zf.entries.map(&:name)).to match_array %w(teh_folder/ teh_folder/file2.txt teh_folder/empty_folder/ file3.txt)
+ expect(zf.entries.map(&:name)).to match_array %w[teh_folder/ teh_folder/file2.txt teh_folder/empty_folder/ file3.txt]
end
end
@@ -815,7 +815,7 @@ describe ContentExportsApiController, type: :request do
expect(export.settings["errors"].map(&:first)).to include("Skipped file file1.txt due to error")
tf = export.attachment.open need_local_file: true
Zip::File.open(tf) do |zf|
- expect(zf.entries.select { |entry| entry.ftype == :file }.map(&:name)).to match_array %w(hidden.txt teh_folder/file2.txt)
+ expect(zf.entries.select { |entry| entry.ftype == :file }.map(&:name)).to match_array %w[hidden.txt teh_folder/file2.txt]
end
end
@@ -850,7 +850,7 @@ describe ContentExportsApiController, type: :request do
expect(export.attachment).to be_present
tf = export.attachment.open need_local_file: true
Zip::File.open(tf) do |zf|
- expect(zf.entries.map(&:name)).to match_array %w(file1.txt)
+ expect(zf.entries.map(&:name)).to match_array %w[file1.txt]
end
end
@@ -865,7 +865,7 @@ describe ContentExportsApiController, type: :request do
expect(export.attachment).to be_present
tf = export.attachment.open need_local_file: true
Zip::File.open(tf) do |zf|
- expect(zf.entries.map(&:name)).to match_array %w(file1.txt)
+ expect(zf.entries.map(&:name)).to match_array %w[file1.txt]
end
end
diff --git a/spec/apis/v1/context_modules_api_spec.rb b/spec/apis/v1/context_modules_api_spec.rb
index f32d9daca0e..4e5c8e71c33 100644
--- a/spec/apis/v1/context_modules_api_spec.rb
+++ b/spec/apis/v1/context_modules_api_spec.rb
@@ -172,7 +172,7 @@ describe "Modules API", type: :request do
it "includes items if requested" do
json = api_call(:get, "/api/v1/courses/#{@course.id}/modules?include[]=items",
:controller => "context_modules_api", :action => "index", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items))
+ :course_id => @course.id.to_s, :include => %w[items])
expect(json.map { |mod| mod['items'].size }).to eq [5, 2, 0]
end
@@ -187,7 +187,7 @@ describe "Modules API", type: :request do
json = api_call(:get, "/api/v1/courses/#{@course.id}/modules?include[]=items",
:controller => "context_modules_api", :action => "index", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items))
+ :course_id => @course.id.to_s, :include => %w[items])
expect(json.map { |mod| mod['items'].size }).to eq [4, 3]
end
@@ -195,7 +195,7 @@ describe "Modules API", type: :request do
let(:json) do
api_call(:get, "/api/v1/courses/#{@course.id}/modules?include[]=items&include[]=content_details",
:controller => "context_modules_api", :action => "index", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items content_details))
+ :course_id => @course.id.to_s, :include => %w[items content_details])
end
let(:assignment_details) { json.find { |mod| mod['id'] == @module1.id }['items'].find { |item| item['id'] == @assignment_tag.id }['content_details'] }
let(:wiki_page_details) { json.find { |mod| mod['id'] == @module2.id }['items'].find { |item| item['id'] == @wiki_page_tag.id }['content_details'] }
@@ -234,7 +234,7 @@ describe "Modules API", type: :request do
Setting.set('api_max_per_page', '3')
json = api_call(:get, "/api/v1/courses/#{@course.id}/modules?include[]=items",
:controller => "context_modules_api", :action => "index", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items))
+ :course_id => @course.id.to_s, :include => %w[items])
expect(json.map { |mod| mod['items'].try(:size) }).to eq [nil, 2, 0]
end
@@ -288,7 +288,7 @@ describe "Modules API", type: :request do
json = api_call(:get, "/api/v1/courses/#{@course.id}/modules?include[]=items&search_term=spur",
:controller => "context_modules_api", :action => "index", :format => "json",
- :course_id => @course.id.to_s, :include => %w{items}, :search_term => "spur")
+ :course_id => @course.id.to_s, :include => %w[items], :search_term => "spur")
expect(json.size).to eq 4
expect(json.map { |mod| mod['id'] }.sort).to eq (matching_mods + nonmatching_mods).map(&:id).sort
@@ -322,12 +322,12 @@ describe "Modules API", type: :request do
let(:module1_json) do
api_call(:get, "/api/v1/courses/#{@course.id}/modules/#{@module1.id}?include[]=items&include[]=content_details",
:controller => "context_modules_api", :action => "show", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items content_details), :id => @module1.id.to_s)
+ :course_id => @course.id.to_s, :include => %w[items content_details], :id => @module1.id.to_s)
end
let(:module2_json) do
api_call(:get, "/api/v1/courses/#{@course.id}/modules/#{@module2.id}?include[]=items&include[]=content_details",
:controller => "context_modules_api", :action => "show", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items content_details), :id => @module2.id.to_s)
+ :course_id => @course.id.to_s, :include => %w[items content_details], :id => @module2.id.to_s)
end
let(:assignment_details) { module1_json['items'].find { |item| item['id'] == @assignment_tag.id }['content_details'] }
let(:wiki_page_details) { module2_json['items'].find { |item| item['id'] == @wiki_page_tag.id }['content_details'] }
@@ -370,15 +370,15 @@ describe "Modules API", type: :request do
it "includes items if requested" do
json = api_call(:get, "/api/v1/courses/#{@course.id}/modules/#{@module1.id}?include[]=items",
:controller => "context_modules_api", :action => "show", :format => "json",
- :course_id => @course.id.to_s, :id => @module1.id.to_param, :include => %w(items))
- expect(json['items'].map { |item| item['type'] }).to eq %w(Assignment Quiz Discussion SubHeader ExternalUrl)
+ :course_id => @course.id.to_s, :id => @module1.id.to_param, :include => %w[items])
+ expect(json['items'].map { |item| item['type'] }).to eq %w[Assignment Quiz Discussion SubHeader ExternalUrl]
end
it "does not include items if there are too many" do
Setting.set('api_max_per_page', '3')
json = api_call(:get, "/api/v1/courses/#{@course.id}/modules/#{@module1.id}?include[]=items",
:controller => "context_modules_api", :action => "show", :format => "json",
- :course_id => @course.id.to_s, :id => @module1.id.to_param, :include => %w(items))
+ :course_id => @course.id.to_s, :id => @module1.id.to_param, :include => %w[items])
expect(json['items']).to be_nil
end
end
@@ -402,7 +402,7 @@ describe "Modules API", type: :request do
it "publishes modules (and their tags)" do
json = api_call(:put, @path, @path_opts, { :event => 'publish', :module_ids => @ids_to_update })
expect(json['completed'].sort).to eq @ids_to_update
- expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w(active active unpublished active)
+ expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w[active active unpublished active]
@wiki_page_tag.reload
expect(@wiki_page_tag.active?).to eq true
@@ -413,19 +413,19 @@ describe "Modules API", type: :request do
it "unpublishes modules" do
json = api_call(:put, @path, @path_opts, { :event => 'unpublish', :module_ids => @ids_to_update })
expect(json['completed'].sort).to eq @ids_to_update
- expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w(active unpublished unpublished unpublished)
+ expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w[active unpublished unpublished unpublished]
end
it "deletes modules" do
json = api_call(:put, @path, @path_opts, { :event => 'delete', :module_ids => @ids_to_update })
expect(json['completed'].sort).to eq @ids_to_update
- expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w(active deleted unpublished deleted)
+ expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w[active deleted unpublished deleted]
end
it "converts module ids to integer and ignore non-numeric ones" do
- json = api_call(:put, @path, @path_opts, { :event => 'publish', :module_ids => %w(lolcats abc123) + @ids_to_update.map(&:to_s) })
+ json = api_call(:put, @path, @path_opts, { :event => 'publish', :module_ids => %w[lolcats abc123] + @ids_to_update.map(&:to_s) })
expect(json['completed'].sort).to eq @ids_to_update
- expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w(active active unpublished active)
+ expect(@test_modules.map { |tm| tm.reload.workflow_state }).to eq %w[active active unpublished active]
end
it "does not update soft-deleted modules" do
@@ -799,12 +799,12 @@ describe "Modules API", type: :request do
let(:module1_json) do
api_call(:get, "/api/v1/courses/#{@course.id}/modules/#{@module1.id}?include[]=items&include[]=content_details",
:controller => "context_modules_api", :action => "show", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items content_details), :id => @module1.id.to_s)
+ :course_id => @course.id.to_s, :include => %w[items content_details], :id => @module1.id.to_s)
end
let(:module2_json) do
api_call(:get, "/api/v1/courses/#{@course.id}/modules/#{@module2.id}?include[]=items&include[]=content_details",
:controller => "context_modules_api", :action => "show", :format => "json",
- :course_id => @course.id.to_s, :include => %w(items content_details), :id => @module2.id.to_s)
+ :course_id => @course.id.to_s, :include => %w[items content_details], :id => @module2.id.to_s)
end
let(:assignment_details) { module1_json['items'].find { |item| item['id'] == @assignment_tag.id }['content_details'] }
let(:wiki_page_details) { module2_json['items'].find { |item| item['id'] == @wiki_page_tag.id }['content_details'] }
@@ -964,7 +964,7 @@ describe "Modules API", type: :request do
{}, {}, { :expected_status => 401 })
api_call(:put, "/api/v1/courses/#{@course.id}/modules?event=publish&module_ids[]=1",
{ :controller => "context_modules_api", :action => "batch_update", :event => 'publish',
- :module_ids => %w(1), :format => "json", :course_id => @course.id.to_s },
+ :module_ids => %w[1], :format => "json", :course_id => @course.id.to_s },
{}, {}, { :expected_status => 401 })
api_call(:put, "/api/v1/courses/#{@course.id}/modules/#{@module1.id}",
{ :controller => "context_modules_api", :action => "update", :format => "json",
diff --git a/spec/apis/v1/conversations_api_spec.rb b/spec/apis/v1/conversations_api_spec.rb
index 6e2ea3a4c6b..7ae1f8f4bdd 100644
--- a/spec/apis/v1/conversations_api_spec.rb
+++ b/spec/apis/v1/conversations_api_spec.rb
@@ -2156,7 +2156,7 @@ describe ConversationsController, type: :request do
# it "should mark conversations as subscribed"
# it "should mark conversations as unsubscribed"
it "archives conversations" do
- conversations = %w(archived read unread).map do |state|
+ conversations = %w[archived read unread].map do |state|
conversation(@me, @bob, :workflow_state => state)
end
expect(@me.reload.unread_conversations_count).to eql(1)
diff --git a/spec/apis/v1/courses_api_spec.rb b/spec/apis/v1/courses_api_spec.rb
index 85547f484f1..6098becade9 100644
--- a/spec/apis/v1/courses_api_spec.rb
+++ b/spec/apis/v1/courses_api_spec.rb
@@ -457,7 +457,7 @@ describe Api::V1::Course do
end
describe CoursesController, type: :request do
- let(:user_api_fields) { %w(id name sortable_name short_name created_at) }
+ let(:user_api_fields) { %w[id name sortable_name short_name created_at] }
before :once do
course_with_teacher(:active_all => true, :user => user_with_pseudonym(:name => 'UWP'))
@@ -631,7 +631,7 @@ describe CoursesController, type: :request do
c4 = course_with_student(user: @student, course_name: 'xyz', active_all: true).course
@student.set_preference(:course_nicknames, c4.id, 'ghi')
json = api_call(:get, "/api/v1/courses.json", controller: 'courses', action: 'index', format: 'json')
- expect(json.map { |course| course['name'] }).to eq %w(abc def ghi jkl)
+ expect(json.map { |course| course['name'] }).to eq %w[abc def ghi jkl]
end
it "excludes master courses if requested" do
@@ -2761,7 +2761,7 @@ describe CoursesController, type: :request do
{ :state => ['available'] })
expect(json.collect { |c| c['id'].to_i }.sort).to eq [@course1.id, @course2.id].sort
json.collect { |c| c['workflow_state'] }.each do |s|
- expect(%w{available}).to include(s)
+ expect(%w[available]).to include(s)
end
end
@@ -2771,7 +2771,7 @@ describe CoursesController, type: :request do
{ :state => ['unpublished'] })
expect(json.collect { |c| c['id'].to_i }.sort).to eq [@course3.id, @course4.id].sort
json.collect { |c| c['workflow_state'] }.each do |s|
- expect(%w{unpublished}).to include(s)
+ expect(%w[unpublished]).to include(s)
end
end
@@ -2781,7 +2781,7 @@ describe CoursesController, type: :request do
{ :state => ['unpublished', 'available'] })
expect(json.collect { |c| c['id'].to_i }.sort).to eq [@course1.id, @course2.id, @course3.id, @course4.id].sort
json.collect { |c| c['workflow_state'] }.each do |s|
- expect(%w{available unpublished}).to include(s)
+ expect(%w[available unpublished]).to include(s)
end
end
@@ -2793,7 +2793,7 @@ describe CoursesController, type: :request do
expect(json[0]['enrollments']).to eq [{ 'type' => 'teacher', 'role' => 'SuperTeacher', 'role_id' => @role.id, 'user_id' => @me.id,
'enrollment_state' => 'invited', "limit_privileges_to_course_section" => false }]
json.collect { |c| c['workflow_state'] }.each do |s|
- expect(%w{unpublished}).to include(s)
+ expect(%w[unpublished]).to include(s)
end
end
@@ -2929,7 +2929,7 @@ describe CoursesController, type: :request do
@user = @me
json = api_call(:get, "/api/v1/courses/#{@course2.id}/students.json",
{ :controller => 'courses', :action => 'students', :course_id => @course2.id.to_s, :format => 'json' })
- %w{sis_user_id unique_id}.each do |attribute|
+ %w[sis_user_id unique_id].each do |attribute|
expect(json.map { |u| u[attribute] }).to eq [nil, nil]
end
end
@@ -3325,7 +3325,7 @@ describe CoursesController, type: :request do
expect(normal['login_id']).to eq @user.pseudonym.unique_id
secret = json.detect { |h| h['id'] == secretstudent.id }
- expect(secret.keys & %w{email login_id}).to be_empty
+ expect(secret.keys & %w[email login_id]).to be_empty
end
end
@@ -3368,7 +3368,7 @@ describe CoursesController, type: :request do
{ :controller => 'courses', :action => 'users', :course_id => @course1.to_param, :format => 'json' },
:enrollment_type => ['student', 'student_view', 'teacher'], :include => ['enrollments'])
- expect(json.map { |u| u['enrollments'].map { |e| e['type'] } }.flatten.uniq.sort).to eq %w{StudentEnrollment StudentViewEnrollment TeacherEnrollment}
+ expect(json.map { |u| u['enrollments'].map { |e| e['type'] } }.flatten.uniq.sort).to eq %w[StudentEnrollment StudentViewEnrollment TeacherEnrollment]
end
describe "enrollment_role" do
@@ -3407,7 +3407,7 @@ describe CoursesController, type: :request do
it "accepts an array of enrollment roles" do
json = api_call(:get, "/api/v1/courses/#{@course1.id}/users.json",
{ :controller => 'courses', :action => 'users', :course_id => @course1.id.to_s, :format => 'json' },
- :enrollment_role => %w{StudentEnrollment EliteStudent})
+ :enrollment_role => %w[StudentEnrollment EliteStudent])
expect(json.map { |x| x["id"].to_i }.sort).to eq [@student1, @student2, @student3].map(&:id).sort
end
@@ -3469,7 +3469,7 @@ describe CoursesController, type: :request do
{ :controller => 'courses', :action => 'users', :course_id => @course2.id.to_s, :format => 'json' },
:enrollment_type => 'student')
expect(json.length).to eq 2
- %w{sis_user_id unique_id}.each do |attribute|
+ %w[sis_user_id unique_id].each do |attribute|
expect(json.map { |u| u[attribute] }).to eq [nil, nil]
end
end
@@ -3554,7 +3554,7 @@ describe CoursesController, type: :request do
json = api_call(:get, "/api/v1/courses/#{@course1.to_param}/users",
{ :controller => 'courses', :action => 'users',
:course_id => @course1.to_param, :format => 'json' },
- { :include => %w{email} })
+ { :include => %w[email] })
json.each do |u|
if u['id'] == @user.id
expect(u['email']).to eq @user.email
@@ -3646,7 +3646,7 @@ describe CoursesController, type: :request do
it "includes custom links if requested" do
json = api_call(:get, "/api/v1/courses/#{@course1.id}/users.json?include[]=custom_links",
{ :controller => 'courses', :action => 'users', :course_id => @course1.id.to_s,
- :format => 'json', :include => %w(custom_links) })
+ :format => 'json', :include => %w[custom_links] })
expect(json.first).to have_key 'custom_links'
end
@@ -3659,7 +3659,7 @@ describe CoursesController, type: :request do
it "puts analytics 2 in custom links if installed" do
json = api_call_as_user(@ta, :get, "/api/v1/courses/#{@course1.id}/users.json?include[]=custom_links",
{ :controller => 'courses', :action => 'users', :course_id => @course1.to_param,
- :format => 'json', :include => %w(custom_links) })
+ :format => 'json', :include => %w[custom_links] })
student1_json = json.find { |u| u['id'] == @student1.id }
expect(student1_json['custom_links']).to include({
'text' => 'Analytics 2',
@@ -3674,7 +3674,7 @@ describe CoursesController, type: :request do
it "respects tool permissions" do
json = api_call_as_user(@student1, :get, "/api/v1/courses/#{@course1.id}/users.json?include[]=custom_links",
{ :controller => 'courses', :action => 'users', :course_id => @course1.id.to_s,
- :format => 'json', :include => %w(custom_links) })
+ :format => 'json', :include => %w[custom_links] })
student2_json = json.find { |u| u['id'] == @student2.id }
expect(student2_json['custom_links'].map { |l| l['tool_id'] }).not_to include ContextExternalTool::ANALYTICS_2
end
@@ -4277,7 +4277,7 @@ describe CoursesController, type: :request do
it "sanitizes html and process links" do
@user = @teacher
attachment_model(:context => @course)
- html = %{
+ HTML
res = klass.new.api_user_content(html, @course, @student)
expect(res).to eq html
end
@@ -830,29 +832,33 @@ describe Api do
course_factory
attachment_model(:context => @course)
- html = %{