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.



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

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.



3
4
5
# File 'lib/rails_edge_test/configuration.rb', line 3

def edge_root_path
  @edge_root_path
end

#elm_pathObject

Returns the value of attribute elm_path.



3
4
5
# File 'lib/rails_edge_test/configuration.rb', line 3

def elm_path
  @elm_path
end

#printerObject

Returns the value of attribute printer.



3
4
5
# File 'lib/rails_edge_test/configuration.rb', line 3

def printer
  @printer
end

Instance Method Details

#after_each(&block) ⇒ Object

Provide a block to be executed after running each ‘edge` block



33
34
35
# File 'lib/rails_edge_test/configuration.rb', line 33

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

#before_each(&block) ⇒ Object

Provide a block to be executed before running each ‘edge` block



28
29
30
# File 'lib/rails_edge_test/configuration.rb', line 28

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



23
24
25
# File 'lib/rails_edge_test/configuration.rb', line 23

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



17
18
19
20
# File 'lib/rails_edge_test/configuration.rb', line 17

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

#wrap_edge_execution(&edge) ⇒ Object



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

def wrap_edge_execution(&edge)
  @before_each_blocks.each do |before_each_block|
    before_each_block.call
  end

  edge.call

  @after_each_blocks.each do |after_each_block|
    after_each_block.call
  end
end

#wrap_suite_execution(&block) ⇒ Object



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

def wrap_suite_execution(&block)
  @before_suite_blocks.each do |before_suit_block|
    before_suit_block.call
  end

  block.call
end