From 30143358c83f2c7b98b092adc215c8198b69d4bc Mon Sep 17 00:00:00 2001 From: Sergey Gnuskov Date: Mon, 23 Sep 2024 13:38:04 +0300 Subject: [PATCH] Chore/update versions (#57) Update maximum rails version + some rubocopisation --- .rubocop.yml | 2 +- Gemfile | 4 +- Gemfile.lock | 220 ++++++++++-------- Rakefile | 2 + app/jobs/external_services/api_job.rb | 2 + .../concerns/external_services/action.rb | 2 + app/models/external_services/api_action.rb | 9 +- app/models/external_services/service.rb | 9 +- bin/rails | 8 +- external_services.gemspec | 10 +- lib/external_services.rb | 22 +- lib/external_services/active_record.rb | 60 +++-- lib/external_services/api.rb | 2 + lib/external_services/engine.rb | 2 + lib/external_services/version.rb | 4 +- lib/generators/install_generator.rb | 4 +- lib/generators/service_generator.rb | 2 + lib/rspec/configuration.rb | 4 +- lib/rspec/disabler.rb | 2 + lib/rspec/helpers.rb | 2 + spec/external_services_spec.rb | 2 + spec/rails_helper.rb | 2 + 22 files changed, 221 insertions(+), 155 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 63bae18..3fb1a5a 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,5 @@ AllCops: - TargetRubyVersion: 2.2 + TargetRubyVersion: 2.7 Exclude: - 'lib/generators/templates/**/*' - 'spec/dummy/**/*' diff --git a/Gemfile b/Gemfile index 2265642..fb66d17 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' # Specify your gem's dependencies in external_services.gemspec @@ -6,10 +8,10 @@ gemspec gem 'rake', '~> 13.0' gem 'sqlite3' +gem 'net-smtp', require: false # HACK: for pre 7.0.1 rails and 3.1 ruby gem 'overcommit' gem 'rubocop', '~> 1.0', require: false gem 'rubocop-rspec' -gem 'net-smtp', require: false # hack for pre 7.0.1 rails and 3.1 ruby gem 'pry', '>= 0.14' gem 'pry-rails', '~> 0.3.9' diff --git a/Gemfile.lock b/Gemfile.lock index 4552ca1..14a0ab1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,90 +1,102 @@ PATH remote: . specs: - external_services (0.5.2) + external_services (0.5.3) faraday (>= 1.4, < 2) faraday_middleware (>= 1.0, < 2) - rails (>= 4.2.5, < 7.1) + rails (>= 4.2.5, < 8) GEM remote: https://rubygems.org/ specs: - actioncable (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) + actioncable (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + zeitwerk (~> 2.6) + actionmailbox (7.1.3.3) + actionpack (= 7.1.3.3) + activejob (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.7.2) - actionpack (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activesupport (= 7.0.7.2) + actionmailer (7.1.3.3) + actionpack (= 7.1.3.3) + actionview (= 7.1.3.3) + activejob (= 7.1.3.3) + activesupport (= 7.1.3.3) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp - rails-dom-testing (~> 2.0) - actionpack (7.0.7.2) - actionview (= 7.0.7.2) - activesupport (= 7.0.7.2) - rack (~> 2.0, >= 2.2.4) + rails-dom-testing (~> 2.2) + actionpack (7.1.3.3) + actionview (= 7.1.3.3) + activesupport (= 7.1.3.3) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4) + rack-session (>= 1.0.1) rack-test (>= 0.6.3) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.7.2) - actionpack (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + actiontext (7.1.3.3) + actionpack (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.7.2) - activesupport (= 7.0.7.2) + actionview (7.1.3.3) + activesupport (= 7.1.3.3) builder (~> 3.1) - erubi (~> 1.4) - rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.7.2) - activesupport (= 7.0.7.2) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.1.3.3) + activesupport (= 7.1.3.3) globalid (>= 0.3.6) - activemodel (7.0.7.2) - activesupport (= 7.0.7.2) - activerecord (7.0.7.2) - activemodel (= 7.0.7.2) - activesupport (= 7.0.7.2) - activestorage (7.0.7.2) - actionpack (= 7.0.7.2) - activejob (= 7.0.7.2) - activerecord (= 7.0.7.2) - activesupport (= 7.0.7.2) + activemodel (7.1.3.3) + activesupport (= 7.1.3.3) + activerecord (7.1.3.3) + activemodel (= 7.1.3.3) + activesupport (= 7.1.3.3) + timeout (>= 0.4.0) + activestorage (7.1.3.3) + actionpack (= 7.1.3.3) + activejob (= 7.1.3.3) + activerecord (= 7.1.3.3) + activesupport (= 7.1.3.3) marcel (~> 1.0) - mini_mime (>= 1.1.0) - activesupport (7.0.7.2) + activesupport (7.1.3.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) ast (2.4.2) + base64 (0.2.0) + bigdecimal (3.1.8) builder (3.2.4) childprocess (0.9.0) ffi (~> 1.0, >= 1.0.11) coderay (1.1.3) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) crass (1.0.6) - date (3.3.3) + date (3.3.4) diff-lcs (1.4.4) - digest (3.1.0) - erubi (1.10.0) + drb (2.2.1) + erubi (1.12.0) factory_bot (4.11.1) activesupport (>= 3.0.0) factory_bot_rails (4.11.1) @@ -116,11 +128,15 @@ GEM faraday_middleware (1.2.0) faraday (~> 1.0) ffi (1.15.5) - globalid (1.1.0) - activesupport (>= 5.0) - i18n (1.14.1) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.5) concurrent-ruby (~> 1.0) iniparse (1.4.4) + io-console (0.7.2) + irb (1.13.1) + rdoc (>= 4.0.0) + reline (>= 0.4.2) loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) @@ -129,25 +145,24 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) - method_source (1.0.0) - mini_mime (1.1.2) - mini_portile2 (2.8.5) - minitest (5.19.0) + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + mini_portile2 (2.8.6) + minitest (5.23.1) multipart-post (2.3.0) - net-imap (0.3.7) + mutex_m (0.2.0) + net-imap (0.4.11) date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.2) timeout - net-smtp (0.3.1) - digest + net-smtp (0.5.0) net-protocol - timeout - nio4r (2.5.9) - nokogiri (1.16.0) + nio4r (2.7.3) + nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) overcommit (0.46.0) @@ -161,40 +176,53 @@ GEM method_source (~> 1.0) pry-rails (0.3.9) pry (>= 0.10.4) - racc (1.7.3) - rack (2.2.8) - rack-test (2.0.2) + psych (5.1.2) + stringio + racc (1.8.0) + rack (3.0.11) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) rack (>= 1.3) - rails (7.0.7.2) - actioncable (= 7.0.7.2) - actionmailbox (= 7.0.7.2) - actionmailer (= 7.0.7.2) - actionpack (= 7.0.7.2) - actiontext (= 7.0.7.2) - actionview (= 7.0.7.2) - activejob (= 7.0.7.2) - activemodel (= 7.0.7.2) - activerecord (= 7.0.7.2) - activestorage (= 7.0.7.2) - activesupport (= 7.0.7.2) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.1.3.3) + actioncable (= 7.1.3.3) + actionmailbox (= 7.1.3.3) + actionmailer (= 7.1.3.3) + actionpack (= 7.1.3.3) + actiontext (= 7.1.3.3) + actionview (= 7.1.3.3) + activejob (= 7.1.3.3) + activemodel (= 7.1.3.3) + activerecord (= 7.1.3.3) + activestorage (= 7.1.3.3) + activesupport (= 7.1.3.3) bundler (>= 1.15.0) - railties (= 7.0.7.2) - rails-dom-testing (2.0.3) - activesupport (>= 4.2.0) + railties (= 7.1.3.3) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.0.7.2) - actionpack (= 7.0.7.2) - activesupport (= 7.0.7.2) - method_source + railties (7.1.3.3) + actionpack (= 7.1.3.3) + activesupport (= 7.1.3.3) + irb + rackup (>= 1.0.0) rake (>= 12.2) - thor (~> 1.0) - zeitwerk (~> 2.5) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.0.3) + rake (13.2.1) + rdoc (6.6.3.1) + psych (>= 4.0.0) regexp_parser (2.4.0) + reline (0.5.7) + io-console (~> 0.5) rexml (3.2.5) rspec-core (3.10.1) rspec-support (~> 3.10.0) @@ -229,15 +257,17 @@ GEM ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) sqlite3 (1.4.2) - thor (1.2.1) - timeout (0.2.0) + stringio (3.1.0) + thor (1.3.1) + timeout (0.4.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (2.1.0) + webrick (1.8.1) websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.11) + zeitwerk (2.6.14) PLATFORMS ruby @@ -256,4 +286,4 @@ DEPENDENCIES sqlite3 BUNDLED WITH - 2.3.14 + 2.5.9 diff --git a/Rakefile b/Rakefile index b72d3b6..3244dc4 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + begin require 'bundler/setup' rescue LoadError diff --git a/app/jobs/external_services/api_job.rb b/app/jobs/external_services/api_job.rb index 9d15609..bbbda07 100644 --- a/app/jobs/external_services/api_job.rb +++ b/app/jobs/external_services/api_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ExternalServices class ApiJob < ActiveJob::Base queue_as :default diff --git a/app/models/concerns/external_services/action.rb b/app/models/concerns/external_services/action.rb index dd9cbea..d878901 100644 --- a/app/models/concerns/external_services/action.rb +++ b/app/models/concerns/external_services/action.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ExternalServices module Action extend ActiveSupport::Concern diff --git a/app/models/external_services/api_action.rb b/app/models/external_services/api_action.rb index e8c5348..e3b830a 100644 --- a/app/models/external_services/api_action.rb +++ b/app/models/external_services/api_action.rb @@ -1,8 +1,10 @@ +# frozen_string_literal: true + module ExternalServices class ApiAction < ::ActiveRecord::Base include ExternalServices::Action - MAX_ACTION_AGE = ENV.fetch('EXTERNAL_SERVICES_MAX_ACTION_AGE') { '90' }.to_i.days + MAX_ACTION_AGE = ENV.fetch('EXTERNAL_SERVICES_MAX_ACTION_AGE', '90').to_i.days attr_accessor :async @@ -13,8 +15,8 @@ class ApiAction < ::ActiveRecord::Base validates :initiator_id, :initiator_type, :method, :path, :queue, presence: true validate :path_format_correctness - serialize :data, JSON - serialize :options, JSON + serialize :data, coder: JSON + serialize :options, coder: JSON scope :to_create, ->(obj) { where(initiator: obj, method: :post) } @@ -90,6 +92,7 @@ def async def create_or_update(*args) return true unless async + super end end diff --git a/app/models/external_services/service.rb b/app/models/external_services/service.rb index 9594ffc..8996b6b 100644 --- a/app/models/external_services/service.rb +++ b/app/models/external_services/service.rb @@ -1,13 +1,15 @@ +# frozen_string_literal: true + module ExternalServices class Service < ::ActiveRecord::Base self.table_name = :external_services belongs_to :subject, polymorphic: true - serialize :extra_data, JSON + serialize :extra_data, coder: JSON after_update :on_first_sync, if: proc { # Rails 5.1+ support - (respond_to?(:saved_change_to_external_id?) ? saved_change_to_external_id? : external_id_changed? ) && - (respond_to?(:external_id_before_last_save) ? external_id_before_last_save : external_id_was).nil? + (respond_to?(:saved_change_to_external_id?) ? saved_change_to_external_id? : external_id_changed?) && + (respond_to?(:external_id_before_last_save) ? external_id_before_last_save : external_id_was).nil? } def self.to_sym @@ -22,6 +24,7 @@ def on_subject_create(subj) def on_subject_update(subj) method = subj.send("#{api_name}_id").present? ? :put : :post return true if (subj.respond_to?(:became_archived?) && subj.became_archived?) && method == :post + subj.send("#{api_name}_api_action", method) end diff --git a/bin/rails b/bin/rails index e7ddb4f..3a773ec 100755 --- a/bin/rails +++ b/bin/rails @@ -1,12 +1,14 @@ #!/usr/bin/env ruby +# frozen_string_literal: true + # This command will automatically be run when you run "rails" with Rails gems # installed from the root of your application. -ENGINE_ROOT = File.expand_path('../..', __FILE__) -ENGINE_PATH = File.expand_path('../../lib/external_services/engine', __FILE__) +ENGINE_ROOT = File.expand_path('..', __dir__) +ENGINE_PATH = File.expand_path('../lib/external_services/engine', __dir__) # Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) require 'rails/all' diff --git a/external_services.gemspec b/external_services.gemspec index cfb1004..dbc9d82 100644 --- a/external_services.gemspec +++ b/external_services.gemspec @@ -1,6 +1,6 @@ -lib = File.expand_path('lib', __dir__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'external_services/version' +# frozen_string_literal: true + +require_relative 'lib/external_services/version' Gem::Specification.new do |spec| spec.name = 'external_services' @@ -22,7 +22,9 @@ Gem::Specification.new do |spec| And there is a sidekiq queue clean function, you should use it on Sidekiq start instead of cleaning all Redis db. MSG + spec.required_ruby_version = '>= 2.7' + spec.add_dependency 'faraday', '>= 1.4', '< 2' spec.add_dependency 'faraday_middleware', '>= 1.0', '< 2' - spec.add_dependency 'rails', ['>= 4.2.5', '< 7.1'] + spec.add_dependency 'rails', '>= 4.2.5', '< 8' end diff --git a/lib/external_services.rb b/lib/external_services.rb index 2c7c516..db4c47f 100644 --- a/lib/external_services.rb +++ b/lib/external_services.rb @@ -1,18 +1,20 @@ -require 'external_services/engine' -require 'external_services/version' +# frozen_string_literal: true -require 'external_services/active_record' -require 'external_services/api' -require 'generators/install_generator' -require 'generators/service_generator' +require_relative 'external_services/engine' +require_relative 'external_services/version' + +require_relative 'external_services/active_record' +require_relative 'external_services/api' +require_relative 'generators/install_generator' +require_relative 'generators/service_generator' if defined?(::RSpec::Core) - require 'rspec/configuration' - require 'rspec/helpers' + require_relative 'rspec/configuration' + require_relative 'rspec/helpers' end -Dir[File.join(File.expand_path('lib/external_services'), 'api', '*.rb')].each do |api| - require api +Dir[File.join(File.expand_path('lib/external_services'), 'api', '*.rb')].sort.each do |api| + require_relative api end module ExternalServices diff --git a/lib/external_services/active_record.rb b/lib/external_services/active_record.rb index 90bb8be..71a72f8 100644 --- a/lib/external_services/active_record.rb +++ b/lib/external_services/active_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ExternalServices module ActiveRecord module HasExternalService @@ -24,13 +26,11 @@ def has_external_service(name, options = {}) extend service_class::SubjectClassMethods if defined? service_class::SubjectClassMethods include service_class::SubjectMethods if defined? service_class::SubjectMethods - # rubocop:disable Lint/HandleExceptions begin service_module = const_get(name.to_s.camelize, false) include service_module rescue NameError end - # rubocop:enable Lint/HandleExceptions end def includes_external_services @@ -106,7 +106,7 @@ def define_external_service_callbacks(name, options = {}) before_destroy :halt_on_external_services_syncing end - after_save :"#{name}_on_create", if: proc { # Rails 5.1+ support + after_save :"#{name}_on_create", if: proc { # Rails 5.1+ support respond_to?(:saved_change_to_id?) ? saved_change_to_id? : id_changed? } @@ -120,7 +120,6 @@ def define_external_service_callbacks(name, options = {}) define_method :"#{name}_on_create" do public_send(service_assoc).on_subject_create(self) unless only_api_actions end - protected :"#{name}_on_create" define_method :"#{name}_on_update" do public_send(service_assoc).on_subject_update(self) unless only_api_actions @@ -129,17 +128,16 @@ def define_external_service_callbacks(name, options = {}) define_method :"#{name}_on_destroy" do public_send(service_assoc).on_subject_destroy(self) unless only_api_actions end - protected :"#{name}_on_destroy" - - protected def halt_on_external_services_syncing - if external_services_syncing? - errors.add :base, :external_services_sync_in_process - if ::ActiveRecord::VERSION::MAJOR < 5 - return false - else - throw :abort - end - end + + protected + + def halt_on_external_services_syncing + return unless external_services_syncing? + + errors.add :base, :external_services_sync_in_process + return false if ::ActiveRecord::VERSION::MAJOR < 5 + + throw :abort end end # rubocop:enable Metrics/AbcSize, Metrics/MethodLength, Metrics/PerceivedComplexity @@ -166,13 +164,13 @@ def define_external_service_sync_methods(name, _options = {}) end define_method :external_services_synced? do - result = (!defined?(super) || super()) + result = !defined?(super) || super() result &&= public_send(synced_method) unless public_send(disabled_method) result end define_method :external_services_syncing? do - result = (defined?(super) && super()) + result = defined?(super) && super() result ||= public_send(syncing_method) unless public_send(disabled_method) result end @@ -217,14 +215,12 @@ def define_external_service_helper_methods(name, _options = {}) end define_method :"without_#{name}_api" do |&blk| - begin - old = send :"#{name}_api_disabled" - send :"#{name}_api_disabled=", true + old = send :"#{name}_api_disabled" + send :"#{name}_api_disabled=", true - blk.call - ensure - send :"#{name}_api_disabled=", old - end + blk.call + ensure + send :"#{name}_api_disabled=", old end define_method :"find_all_by_#{name}_ids" do |ids| @@ -272,13 +268,13 @@ def define_external_service_helper_methods(name, _options = {}) action = "ExternalServices::ApiActions::#{name.to_s.camelize}".constantize.new( initiator: self, - name: args[:name] || self.class.send(:"#{name}_api_name"), - method: method, - path: path, - data: data, - queue: args[:queue], - options: options, - async: async + name: args[:name] || self.class.send(:"#{name}_api_name"), + method: method, + path: path, + data: data, + queue: args[:queue], + options: options, + async: async ) if async @@ -299,5 +295,5 @@ def define_external_service_helper_methods(name, _options = {}) end ActiveSupport.on_load :active_record do - ActiveRecord::Base.send :include, ExternalServices::ActiveRecord::HasExternalService + ActiveRecord::Base.include ExternalServices::ActiveRecord::HasExternalService end diff --git a/lib/external_services/api.rb b/lib/external_services/api.rb index 58c7c33..e991b11 100644 --- a/lib/external_services/api.rb +++ b/lib/external_services/api.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'faraday' require 'faraday_middleware' diff --git a/lib/external_services/engine.rb b/lib/external_services/engine.rb index 42160c6..9ff501f 100644 --- a/lib/external_services/engine.rb +++ b/lib/external_services/engine.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails' module ExternalServices class Engine < ::Rails::Engine diff --git a/lib/external_services/version.rb b/lib/external_services/version.rb index 9daa5b3..ac8f6bf 100644 --- a/lib/external_services/version.rb +++ b/lib/external_services/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ExternalServices - VERSION = '0.5.2'.freeze + VERSION = '0.5.3' end diff --git a/lib/generators/install_generator.rb b/lib/generators/install_generator.rb index b29734f..fe7b406 100644 --- a/lib/generators/install_generator.rb +++ b/lib/generators/install_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails/generators' require 'rails/generators/active_record' @@ -15,7 +17,7 @@ def migration_version return unless Rails::VERSION::MAJOR >= 5 "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" - end + end def create_migration_files add_migration('create_external_services') diff --git a/lib/generators/service_generator.rb b/lib/generators/service_generator.rb index e5368fe..a7710e0 100644 --- a/lib/generators/service_generator.rb +++ b/lib/generators/service_generator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails/generators' require 'rails/generators/active_record' diff --git a/lib/rspec/configuration.rb b/lib/rspec/configuration.rb index 5d70ea1..6c4de59 100644 --- a/lib/rspec/configuration.rb +++ b/lib/rspec/configuration.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ExternalServices module RSpec module Configuration @@ -18,4 +20,4 @@ def add_external_service(name) end end -RSpec::Core::Configuration.send(:include, ExternalServices::RSpec::Configuration) +RSpec::Core::Configuration.include ExternalServices::RSpec::Configuration diff --git a/lib/rspec/disabler.rb b/lib/rspec/disabler.rb index ab79951..d88a38f 100644 --- a/lib/rspec/disabler.rb +++ b/lib/rspec/disabler.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ExternalServices module RSpec module Disabler diff --git a/lib/rspec/helpers.rb b/lib/rspec/helpers.rb index a3cb60e..ba25822 100644 --- a/lib/rspec/helpers.rb +++ b/lib/rspec/helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rspec/disabler' module ExternalServices diff --git a/spec/external_services_spec.rb b/spec/external_services_spec.rb index 6626d2e..81c95e9 100644 --- a/spec/external_services_spec.rb +++ b/spec/external_services_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rails_helper' describe ExternalServices do diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 458e1dc..45a77c5 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test'