Sha256: ff66ac43650a10b7a8b529c225ed87663370c7773377b79bda4c6df9cc4c68c4
Contents?: true
Size: 821 Bytes
Versions: 1
Compression:
Stored size: 821 Bytes
Contents
# frozen_string_literal: true require 'fileutils' module SpecFilesSetup def setup_env!(path, file) full_path = "#{RSPEC_ROOT}/dummy/#{path}" FileUtils.mkdir_p full_path File.open(File.join(full_path, file), 'w+') do |f| if /\.ya?ml\z/i.match?(file) f.write yaml_data else f.write json_data end end end def clear_env!(path) FileUtils.remove_entry("#{RSPEC_ROOT}/dummy/#{path}") rescue Errno::EACCES puts "Cannot remove #{path}" end private def json_data <<~DATA { "nested": { "test": "string" }, "interpolated": "Value is {{a}}" } DATA end def yaml_data <<~DATA test: string interpolated: Value is {{a}} DATA end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
messages_dictionary-2.1.0 | spec/support/spec_files_setup.rb |