spec/support/file_helpers.rb in LittleWeasel-4.0.0 vs spec/support/file_helpers.rb in LittleWeasel-5.0.0
- old
+ new
@@ -2,21 +2,35 @@
require_relative '../../lib/LittleWeasel/modules/locale'
module Support
# This module contains methods to help with dictionary files.
- module FileHelpers
+
+ class Locale
include LittleWeasel::Modules::Locale
+ attr_accessor :language, :region
+
+ def initialize(language:, region:)
+ self.language = language
+ self.region = region
+ end
+ end
+
+ module FileHelpers
module_function
+ def locale_for(language:, region: nil)
+ Locale.new(language: language, region: region).locale
+ end
+
def region_dictionary_path language:, region:
- file_name = FileHelpers.locale language: language, region: region
+ file_name = locale_for language: language, region: region
dictionary_path_for file_name: file_name
end
def language_dictionary_path language:
- file_name = FileHelpers.locale language:language
+ file_name = locale_for language: language
dictionary_path_for file_name: file_name
end
# :reek:UtilityFunction - ignored, this is only for specs.
def dictionary_path_for(locale: nil, file_name: nil)