Sha256: 8d22a1022ec1a5c0ec8cd36824024cd4a08f3761099dbc7da77797acb3023cd5
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# Used to initialize postspec from spec/spec_helper.rb or spec/postspec_helper.rb # module Postspec Config = Struct.new(:database, :mode, :reflections, :anchors, :fail_fast) @database = nil @mode = nil @reflections = nil @anchors = nil @fail_fast = nil DEFAULT_MODE = :empty DEFAULT_FAIL_FAST = true def self.database() @database end def self.mode() @mode end def self.reflections() @reflections end def self.anchors() @anchors end def self.fail_fast() @fail_fast end def self.configure(&block) config = Config.new(@database, DEFAULT_MODE, nil, nil, DEFAULT_FAIL_FAST) yield(config) @database = config.database @mode = config.mode || DEFAULT_MODE @reflections = config.reflections @anchors = config.anchors @fail_fast = config.fail_fast || DEFAULT_FAIL_FAST self end def self.postspec() !@database.nil? or raise Error, "Database unspecified" @postspec ||= Postspec.new( PgConn.new(@database), mode: mode, reflector: @reflections, anchors: @anchors, fail: @fail_fast) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
postspec-0.1.1 | lib/postspec/config.rb |