Module: Messiah

Defined in:
lib/messiah.rb

Defined Under Namespace

Modules: Generator, Rack, Supports Classes: Config, Configurator

Constant Summary collapse

VERSION =
File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



29
30
31
# File 'lib/messiah.rb', line 29

def config
  @config
end

.frozen_configObject

Returns the value of attribute frozen_config.



29
30
31
# File 'lib/messiah.rb', line 29

def frozen_config
  @frozen_config
end

Class Method Details

.after_test(*args) ⇒ Object



70
71
# File 'lib/messiah.rb', line 70

def after_test(*args)
end

.before_suite(*args) ⇒ Object



61
62
63
# File 'lib/messiah.rb', line 61

def before_suite(*args)
  Messiah.freeze_config!
end

.before_test(*args) ⇒ Object



65
66
67
68
# File 'lib/messiah.rb', line 65

def before_test(*args)
  Messiah.reset_config!
  DatabaseCleaner.clean if Messiah.database
end

.configure(&block) ⇒ Object



31
32
33
34
35
36
# File 'lib/messiah.rb', line 31

def configure(&block)
  @config ||= Config.new
  @config.instance_eval(&block)

  Configurator.configure!(@config)
end

.cucumber(world) ⇒ Object



56
57
58
59
# File 'lib/messiah.rb', line 56

def cucumber(world)
  world.AfterConfiguration(&Messiah.method(:before_suite))
  world.Before(&Messiah.method(:before_test))
end

.freeze_config!Object



42
43
44
# File 'lib/messiah.rb', line 42

def freeze_config!
  @frozen_config = @config.values.clone
end

.method_missing(key, *args, &block) ⇒ Object



38
39
40
# File 'lib/messiah.rb', line 38

def method_missing(key, *args, &block)
  @config.send(key, *args, &block)
end

.reset_config!Object



46
47
48
# File 'lib/messiah.rb', line 46

def reset_config!
  @config.values = @frozen_config.clone
end

.rspec(config) ⇒ Object



50
51
52
53
54
# File 'lib/messiah.rb', line 50

def rspec(config)
  config.before(:suite, &Messiah.method(:before_suite))
  config.before(:each, &Messiah.method(:before_test))
  config.after(:each, &Messiah.method(:after_test))
end