Skip to content

Commit

Permalink
refactor: Prefer __dir__
Browse files Browse the repository at this point in the history
  • Loading branch information
olleolleolle committed Jun 7, 2022
1 parent b84bba6 commit 7b8bc77
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/sepa_king/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def transaction_group(transaction)
end

def validate_final_document!(document, schema_name)
xsd = Nokogiri::XML::Schema(File.read(File.expand_path("../../../lib/schema/#{schema_name}.xsd", __FILE__)))
xsd = Nokogiri::XML::Schema(File.read(File.expand_path("../../lib/schema/#{schema_name}.xsd", __dir__)))
errors = xsd.validate(document).map { |error| error.message }
raise SEPA::Error.new("Incompatible with schema #{schema_name}: #{errors.join(', ')}") if errors.any?
end
Expand Down
2 changes: 1 addition & 1 deletion sepa_king.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'sepa_king/version'

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
Dir[File.expand_path(File.join(__dir__, 'support', '**', '*.rb'))].each {|f| require f}

# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
Expand Down

0 comments on commit 7b8bc77

Please sign in to comment.