DEV: use #frozen_string_literal: true on all spec

DEV: use #frozen_string_literal: true on all spec

This change both speeds up specs (less strings to allocate) and helps catch cases where methods in Discourse are mutating inputs.

Overall we will be migrating everything to use #frozen_string_literal: true it will take a while, but this is the first and safest move in this direction

diff --git a/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb b/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb
index 826b5f4..36aca1c 100644
--- a/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb
+++ b/spec/components/active_record/connection_adapters/postgresql_fallback_adapter_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 require_dependency 'active_record/connection_adapters/postgresql_fallback_adapter'
 
diff --git a/spec/components/admin_confirmation_spec.rb b/spec/components/admin_confirmation_spec.rb
index 994ef9d..a6efab9 100644
--- a/spec/components/admin_confirmation_spec.rb
+++ b/spec/components/admin_confirmation_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'admin_confirmation'
 require 'rails_helper'
 
diff --git a/spec/components/admin_user_index_query_spec.rb b/spec/components/admin_user_index_query_spec.rb
index d31e9b5..d2f0afd 100644
--- a/spec/components/admin_user_index_query_spec.rb
+++ b/spec/components/admin_user_index_query_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 require_dependency 'admin_user_index_query'
 
diff --git a/spec/components/archetype_spec.rb b/spec/components/archetype_spec.rb
index dc8d20e..6414980 100644
--- a/spec/components/archetype_spec.rb
+++ b/spec/components/archetype_spec.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+# frozen_string_literal: true
 
 require 'rails_helper'
 require 'archetype'
diff --git a/spec/components/auth/default_current_user_provider_spec.rb b/spec/components/auth/default_current_user_provider_spec.rb
index bf68a08..3027a16 100644
--- a/spec/components/auth/default_current_user_provider_spec.rb
+++ b/spec/components/auth/default_current_user_provider_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 require_dependency 'auth/default_current_user_provider'
 
diff --git a/spec/components/auth/facebook_authenticator_spec.rb b/spec/components/auth/facebook_authenticator_spec.rb
index 3cf67fc..babac8f 100644
--- a/spec/components/auth/facebook_authenticator_spec.rb
+++ b/spec/components/auth/facebook_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Auth::FacebookAuthenticator do
diff --git a/spec/components/auth/github_authenticator_spec.rb b/spec/components/auth/github_authenticator_spec.rb
index 58002fb..0e7264e 100644
--- a/spec/components/auth/github_authenticator_spec.rb
+++ b/spec/components/auth/github_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 def auth_token_for(user)
diff --git a/spec/components/auth/google_oauth2_authenticator_spec.rb b/spec/components/auth/google_oauth2_authenticator_spec.rb
index 49bc007..19824c7 100644
--- a/spec/components/auth/google_oauth2_authenticator_spec.rb
+++ b/spec/components/auth/google_oauth2_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Auth::GoogleOAuth2Authenticator do
diff --git a/spec/components/auth/instagram_authenticator_spec.rb b/spec/components/auth/instagram_authenticator_spec.rb
index d8a3075..2efd982 100644
--- a/spec/components/auth/instagram_authenticator_spec.rb
+++ b/spec/components/auth/instagram_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Auth::InstagramAuthenticator do
diff --git a/spec/components/auth/managed_authenticator_spec.rb b/spec/components/auth/managed_authenticator_spec.rb
index 2af82a2..f29dd6c 100644
--- a/spec/components/auth/managed_authenticator_spec.rb
+++ b/spec/components/auth/managed_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Auth::ManagedAuthenticator do
diff --git a/spec/components/auth/open_id_authenticator_spec.rb b/spec/components/auth/open_id_authenticator_spec.rb
index dd08478..8656b13 100644
--- a/spec/components/auth/open_id_authenticator_spec.rb
+++ b/spec/components/auth/open_id_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Auth::OpenIdAuthenticator do
diff --git a/spec/components/auth/twitter_authenticator_spec.rb b/spec/components/auth/twitter_authenticator_spec.rb
index 208050c..55d9e5f 100644
--- a/spec/components/auth/twitter_authenticator_spec.rb
+++ b/spec/components/auth/twitter_authenticator_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe Auth::TwitterAuthenticator do
diff --git a/spec/components/avatar_lookup_spec.rb b/spec/components/avatar_lookup_spec.rb
index 7cf86af..0a592c6 100644
--- a/spec/components/avatar_lookup_spec.rb
+++ b/spec/components/avatar_lookup_spec.rb
@@ -1,4 +1,5 @@
 # encoding: utf-8
+# frozen_string_literal: true
 
 require 'rails_helper'
 require_dependency 'avatar_lookup'
diff --git a/spec/components/cache_spec.rb b/spec/components/cache_spec.rb
index 0d44360..33c54a5 100644
--- a/spec/components/cache_spec.rb
+++ b/spec/components/cache_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 require 'cache'
 
diff --git a/spec/components/category_badge_spec.rb b/spec/components/category_badge_spec.rb
index ac89883..a5636c9 100644
--- a/spec/components/category_badge_spec.rb
+++ b/spec/components/category_badge_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 require 'category_badge'
 
diff --git a/spec/components/common_passwords/common_passwords_spec.rb b/spec/components/common_passwords/common_passwords_spec.rb
index b78ebee..e05f5a2 100644
--- a/spec/components/common_passwords/common_passwords_spec.rb
+++ b/spec/components/common_passwords/common_passwords_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require "rails_helper"
 require_dependency "common_passwords/common_passwords"
 
diff --git a/spec/components/composer_messages_finder_spec.rb b/spec/components/composer_messages_finder_spec.rb
index fe0b774..ada5f1e 100644
--- a/spec/components/composer_messages_finder_spec.rb
+++ b/spec/components/composer_messages_finder_spec.rb
@@ -1,4 +1,6 @@
 # encoding: utf-8
+# frozen_string_literal: true
+
 require 'rails_helper'
 require 'composer_messages_finder'
 
diff --git a/spec/components/concern/category_hashtag_spec.rb b/spec/components/concern/category_hashtag_spec.rb
index fd23b65..29cf557 100644
--- a/spec/components/concern/category_hashtag_spec.rb
+++ b/spec/components/concern/category_hashtag_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require 'rails_helper'
 
 describe CategoryHashtag do
diff --git a/spec/components/concern/has_custom_fields_spec.rb b/spec/components/concern/has_custom_fields_spec.rb
index 61f3426..b08b75a 100644
--- a/spec/components/concern/has_custom_fields_spec.rb
+++ b/spec/components/concern/has_custom_fields_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require "rails_helper"
 
 describe HasCustomFields do
diff --git a/spec/components/concern/has_search_data_spec.rb b/spec/components/concern/has_search_data_spec.rb
index 9c8b372..4bf0e96 100644
--- a/spec/components/concern/has_search_data_spec.rb
+++ b/spec/components/concern/has_search_data_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require "rails_helper"
 
 describe HasSearchData do
diff --git a/spec/components/concern/positionable_spec.rb b/spec/components/concern/positionable_spec.rb
index 4ab010a..395251d 100644
--- a/spec/components/concern/positionable_spec.rb
+++ b/spec/components/concern/positionable_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
 require "rails_helper"
 
 describe Positionable do
diff --git a/spec/components/concern/searchable_spec.rb b/spec/components/concern/searchable_spec.rb
index 5c55c7d..49726a6 100644
--- a/spec/components/concern/searchable_spec.rb
+++ b/spec/components/concern/searchable_spec.rb
@@ -1,3 +1,5 @@

[... diff too long, it was truncated ...]

GitHub sha: 4ea21fa2

1 Like