Module: RailsEdgeTest::Dsl

Defined in:
lib/rails_edge_test/dsl.rb,
lib/rails_edge_test/dsl/edge.rb,
lib/rails_edge_test/dsl/action.rb,
lib/rails_edge_test/dsl/controller.rb,
lib/rails_edge_test/dsl/let_handler.rb

Defined Under Namespace

Classes: Action, Controller, Edge, LetHandler

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add(controller) ⇒ Object



48
49
50
# File 'lib/rails_edge_test/dsl.rb', line 48

def add(controller)
  @controllers << controller
end

.execute!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/rails_edge_test/dsl.rb', line 14

def execute!
  printer = RailsEdgeTest.configuration.printer.new
  printer.begin_suite

  RailsEdgeTest.configuration.wrap_suite_execution do

    @controllers.each do |controller|
      printer.begin_controller(controller)

      controller.__actions.each do |action|
        printer.begin_action(action)

        action.__edges.each do |edge, block|
          printer.begin_edge(edge)

          RailsEdgeTest.configuration.wrap_edge_execution do
            define_lets(edge, controller.__let_handler)
            define_lets(edge, action.__let_handler)
            edge.instance_exec(&block)
          end

          printer.end_edge
        end

        printer.end_action
      end

      printer.end_controller
    end

  end
  printer.end_suite
end

.reset!Object



10
11
12
# File 'lib/rails_edge_test/dsl.rb', line 10

def reset!
  @controllers = []
end

Instance Method Details

#controller(controller_class, &block) ⇒ Object



3
4
5
6
7
# File 'lib/rails_edge_test/dsl.rb', line 3

def controller(controller_class, &block)
  controller = RailsEdgeTest::Dsl::Controller.new(controller_class)
  controller.instance_exec(&block)
  Dsl.add(controller)
end