spec/spec_helper.rb in schema_dev-4.0.0 vs spec/spec_helper.rb in schema_dev-4.1.0
- old
+ new
@@ -1,20 +1,20 @@
+# frozen_string_literal: true
+
require 'simplecov'
SimpleCov.start
require 'rspec/given'
require 'tempfile'
require 'tmpdir'
require 'webmock/rspec'
require 'schema_dev/config'
-def in_tmpdir
+def in_tmpdir(&block)
Dir.mktmpdir do |dir|
- Dir.chdir(dir) do
- yield
- end
+ Dir.chdir(dir, &block)
end
end
def suppress_stdout_stderr
save_stdout = STDOUT.dup
@@ -29,13 +29,12 @@
STDERR.reopen save_stderr
STDOUT.reopen save_stdout
end
end
-
def get_config(data)
SchemaDev::Config._reset
in_tmpdir do
- Pathname.new(SchemaDev::CONFIG_FILE).open("w") {|f| f.write data.to_yaml }
+ Pathname.new(SchemaDev::CONFIG_FILE).open('w') { |f| f.write data.to_yaml }
SchemaDev::Config.load
end
end