Module: Postspec

Defined in:
lib/postspec.rb,
lib/postspec/frame.rb,
lib/postspec/state.rb,
lib/postspec/config.rb,
lib/postspec/render.rb,
lib/postspec/version.rb,
lib/postspec/environment.rb

Overview

Used to initialize postspec from spec/spec_helper.rb or spec/postspec_helper.rb

Defined Under Namespace

Classes: Config, EmptyFrame, Environment, FoxFrame, Frame, FrameStack, NopFrame, Postspec, Render, SeedFrame, State

Constant Summary collapse

DEFAULT_MODE =
:empty
DEFAULT_FAIL_FAST =
true
DEFAULT_IGNORE =
[]
VERSION =
"0.5.5"

Class Method Summary collapse

Class Method Details

.anchorsObject



21
# File 'lib/postspec/config.rb', line 21

def self.anchors() @anchors end

.cacheObject



24
# File 'lib/postspec/config.rb', line 24

def self.cache() @cache end

.configure {|config| ... } ⇒ Object

Yields:

  • (config)


26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/postspec/config.rb', line 26

def self.configure(&block)
  config = Config.new(@database, DEFAULT_MODE, nil, nil, DEFAULT_FAIL_FAST, DEFAULT_IGNORE, nil)
  yield(config)
  @database = config.database
  @mode = config.mode || DEFAULT_MODE
  @reflections = config.reflections
  @anchors = config.anchors
  @fail_fast = config.fail_fast || DEFAULT_FAIL_FAST
  @ignore = config.ignore || DEFAULT_IGNORE # FIXME: Why not rely on Config defaults?
  @cache = config.cache
  self
end

.databaseObject



18
# File 'lib/postspec/config.rb', line 18

def self.database() @database end

.fail_fastObject



22
# File 'lib/postspec/config.rb', line 22

def self.fail_fast() @fail_fast end

.ignoreObject



23
# File 'lib/postspec/config.rb', line 23

def self.ignore() @ignore end

.modeObject



19
# File 'lib/postspec/config.rb', line 19

def self.mode() @mode end

.postspecObject



39
40
41
42
43
44
# File 'lib/postspec/config.rb', line 39

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, ignore: @ignore, cache: cache)
end

.reflectionsObject



20
# File 'lib/postspec/config.rb', line 20

def self.reflections() @reflections end