Class: Rambo::RSpec::Examples

Inherits:
Object
  • Object
show all
Defined in:
lib/rambo/rspec/examples.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raml, options = nil) ⇒ Examples



8
9
10
11
# File 'lib/rambo/rspec/examples.rb', line 8

def initialize(raml, options=nil)
  @raml    = raml
  @options = options
end

Instance Attribute Details

#examplesObject (readonly)

Returns the value of attribute examples.



6
7
8
# File 'lib/rambo/rspec/examples.rb', line 6

def examples
  @examples
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/rambo/rspec/examples.rb', line 6

def options
  @options
end

#ramlObject (readonly)

Returns the value of attribute raml.



6
7
8
# File 'lib/rambo/rspec/examples.rb', line 6

def raml
  @raml
end

#resourcesObject (readonly)

Returns the value of attribute resources.



6
7
8
# File 'lib/rambo/rspec/examples.rb', line 6

def resources
  @resources
end

Instance Method Details

#composeObject



13
14
15
16
17
# File 'lib/rambo/rspec/examples.rb', line 13

def compose
  return '' unless examples

  examples.join("\n\n")
end

#example_groupsObject



23
24
25
# File 'lib/rambo/rspec/examples.rb', line 23

def example_groups
  @example_groups ||= resources.map {|r| ExampleGroup.new(r, options) }
end

#generate!Object



27
28
29
# File 'lib/rambo/rspec/examples.rb', line 27

def generate!
  @examples = example_groups.map(&:render)
end