Class: Rambo::RSpec::SpecFile
- Inherits:
-
Object
- Object
- Rambo::RSpec::SpecFile
- Defined in:
- lib/rambo/rspec/spec_file.rb
Constant Summary collapse
- TEMPLATE_PATH =
File.('../templates/spec_file_template.erb', __FILE__)
Instance Attribute Summary collapse
-
#examples ⇒ Object
readonly
Returns the value of attribute examples.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#raml ⇒ Object
readonly
Returns the value of attribute raml.
Instance Method Summary collapse
-
#initialize(raml, options = {}) ⇒ SpecFile
constructor
A new instance of SpecFile.
- #render ⇒ Object
- #template ⇒ Object
Constructor Details
#initialize(raml, options = {}) ⇒ SpecFile
14 15 16 17 18 |
# File 'lib/rambo/rspec/spec_file.rb', line 14 def initialize(raml, ={}) @raml = Rambo::RamlModels::Api.new(raml) = @examples = Examples.new(@raml, ) end |
Instance Attribute Details
#examples ⇒ Object (readonly)
Returns the value of attribute examples.
10 11 12 |
# File 'lib/rambo/rspec/spec_file.rb', line 10 def examples @examples end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/rambo/rspec/spec_file.rb', line 10 def end |
#raml ⇒ Object (readonly)
Returns the value of attribute raml.
10 11 12 |
# File 'lib/rambo/rspec/spec_file.rb', line 10 def raml @raml end |
Instance Method Details
#render ⇒ Object
24 25 26 27 28 |
# File 'lib/rambo/rspec/spec_file.rb', line 24 def render b = binding ERB.new(template, 0, "-", "@result").result(raml.instance_eval { b }) @result end |
#template ⇒ Object
20 21 22 |
# File 'lib/rambo/rspec/spec_file.rb', line 20 def template @template ||= File.read(TEMPLATE_PATH) end |