Class: RailsEdgeTest::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_edge_test/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
11
12
13
14
# File 'lib/rails_edge_test/configuration.rb', line 7

def initialize
  self.elm_path = Rails.root.join('spec')
  self.edge_root_path = Rails.root.join('spec', 'edge')
  self.printer = Printers::Boring
  @before_suite_blocks = []
  @before_each_blocks = []
  @after_each_blocks = []
end

Instance Attribute Details

#edge_root_pathObject

Returns the value of attribute edge_root_path.



5
6
7
# File 'lib/rails_edge_test/configuration.rb', line 5

def edge_root_path
  @edge_root_path
end

#elm_pathObject

Returns the value of attribute elm_path.



5
6
7
# File 'lib/rails_edge_test/configuration.rb', line 5

def elm_path
  @elm_path
end

#printerObject

Returns the value of attribute printer.



5
6
7
# File 'lib/rails_edge_test/configuration.rb', line 5

def printer
  @printer
end

Instance Method Details

#after_each(&block) ⇒ Object

Provide a block to be executed after running each edge block



35
36
37
# File 'lib/rails_edge_test/configuration.rb', line 35

def after_each(&block)
  @after_each_blocks << block
end

#before_each(&block) ⇒ Object

Provide a block to be executed before running each edge block



30
31
32
# File 'lib/rails_edge_test/configuration.rb', line 30

def before_each(&block)
  @before_each_blocks << block
end

#before_suite(&block) ⇒ Object

Provide a block to be executed once before running any edge blocks



25
26
27
# File 'lib/rails_edge_test/configuration.rb', line 25

def before_suite(&block)
  @before_suite_blocks << block
end

#include(mod) ⇒ Object

Provide any Module here with methods you would like to be able to access from within an edge block.

Parameters:

  • mod (Module)
    • a module to be included into all edge blocks



19
20
21
22
# File 'lib/rails_edge_test/configuration.rb', line 19

def include(mod)
  Dsl::Controller.include(mod)
  Dsl::Edge.include(mod)
end

#wrap_edge_execution(&edge) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/rails_edge_test/configuration.rb', line 45

def wrap_edge_execution(&edge)
  @before_each_blocks.each(&:call)

  edge.call

  @after_each_blocks.each(&:call)
end

#wrap_suite_execution(&block) ⇒ Object



39
40
41
42
43
# File 'lib/rails_edge_test/configuration.rb', line 39

def wrap_suite_execution(&block)
  @before_suite_blocks.each(&:call)

  block.call
end