Sha256: df815f33b8b1f9d9c3377ea63e6457d6e907d97d6289efd4c4772511201cc904
Contents?: true
Size: 924 Bytes
Versions: 11
Compression:
Stored size: 924 Bytes
Contents
module DefinitionHelpers def with_function_definition(name:, sql_definition:, version: 1, &block) definition = Fx::Definition.new(name: name, version: version) with_definition( definition: definition, sql_definition: sql_definition, block: block, ) end def with_trigger_definition(name:, sql_definition:, version: 1, &block) definition = Fx::Definition.new( name: name, version: version, type: "trigger", ) with_definition( definition: definition, sql_definition: sql_definition, block: block, ) end def with_definition(definition:, sql_definition:, block:) FileUtils.mkdir_p(File.dirname(definition.full_path)) File.open(definition.full_path, "w") { |f| f.write(sql_definition) } block.call ensure File.delete definition.full_path end end RSpec.configure do |config| config.include DefinitionHelpers end
Version data entries
11 entries across 11 versions & 2 rubygems