Class: Apical::Runner

Inherits:
Object
  • Object
show all
Includes:
Rack::Test::Methods
Defined in:
lib/apical/runner.rb

Defined Under Namespace

Classes: Blueprint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Runner

Returns a new instance of Runner.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/apical/runner.rb', line 3

def initialize(&block)
  @resources          = []
  @name               = "apical"
  @desc               = ""
  @accept             = ContentType[:form]
  @content_type       = ContentType[:form]
  @before_each_blocks = []
  @before_all_blocks  = []
  @after_each_blocks  = []
  @after_all_blocks   = []
  Blueprint.new self, &block
end

Instance Attribute Details

#accept ⇒ Object

Returns the value of attribute accept.



18
19
20
# File 'lib/apical/runner.rb', line 18

def accept
  @accept
end

#adapter ⇒ Object

Returns the value of attribute adapter.



18
19
20
# File 'lib/apical/runner.rb', line 18

def adapter
  @adapter
end

#after_all_blocks ⇒ Object

Returns the value of attribute after_all_blocks.



18
19
20
# File 'lib/apical/runner.rb', line 18

def after_all_blocks
  @after_all_blocks
end

#after_each_blocks ⇒ Object

Returns the value of attribute after_each_blocks.



18
19
20
# File 'lib/apical/runner.rb', line 18

def after_each_blocks
  @after_each_blocks
end

#app ⇒ Object

Returns the value of attribute app.



18
19
20
# File 'lib/apical/runner.rb', line 18

def app
  @app
end

#auth_header ⇒ Object

Returns the value of attribute auth_header.



18
19
20
# File 'lib/apical/runner.rb', line 18

def auth_header
  @auth_header
end

#before_all_blocks ⇒ Object

Returns the value of attribute before_all_blocks.



18
19
20
# File 'lib/apical/runner.rb', line 18

def before_all_blocks
  @before_all_blocks
end

#before_each_blocks ⇒ Object

Returns the value of attribute before_each_blocks.



18
19
20
# File 'lib/apical/runner.rb', line 18

def before_each_blocks
  @before_each_blocks
end

#content_type ⇒ Object

Returns the value of attribute content_type.



18
19
20
# File 'lib/apical/runner.rb', line 18

def content_type
  @content_type
end

#desc ⇒ Object

Returns the value of attribute desc.



18
19
20
# File 'lib/apical/runner.rb', line 18

def desc
  @desc
end

#name ⇒ Object

Returns the value of attribute name.



18
19
20
# File 'lib/apical/runner.rb', line 18

def name
  @name
end

#resources ⇒ Object

Returns the value of attribute resources.



18
19
20
# File 'lib/apical/runner.rb', line 18

def resources
  @resources
end

Instance Method Details

#run ⇒ Object



93
94
95
96
97
98
99
100
101
102
# File 'lib/apical/runner.rb', line 93

def run
  @before_all_blocks.each {|block| instance_eval &block }
  @resources.each do |resource|
    @before_each_blocks.each {|block| resource.instance_eval &block }
    resource.run
    @after_each_blocks.each {|block| resource.instance_eval &block }
  end
  @after_all_blocks.each {|block| instance_eval &block }
  self
end