Class: Rambo::RSpec::HelperFile
- Inherits:
-
Object
- Object
- Rambo::RSpec::HelperFile
- Defined in:
- lib/rambo/rspec/helper_file.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(template_path:, file_path:, raml: nil, options: nil) ⇒ HelperFile
constructor
A new instance of HelperFile.
- #render ⇒ Object
Constructor Details
#initialize(template_path:, file_path:, raml: nil, options: nil) ⇒ HelperFile
Returns a new instance of HelperFile.
11 12 13 14 15 16 |
# File 'lib/rambo/rspec/helper_file.rb', line 11 def initialize(template_path:, file_path:, raml: nil, options: nil) @template_path = template_path @file_path = file_path = || { rails: true } @raml = raml ? Rambo::RamlModels::Api.new(raml) : nil end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
9 10 11 |
# File 'lib/rambo/rspec/helper_file.rb', line 9 def end |
Instance Method Details
#generate ⇒ Object
18 19 20 |
# File 'lib/rambo/rspec/helper_file.rb', line 18 def generate write_to_file(render) unless file_already_exists? end |
#render ⇒ Object
22 23 24 25 26 |
# File 'lib/rambo/rspec/helper_file.rb', line 22 def render b = binding ERB.new(template, 0, "-", "@result").result(raml.instance_eval { b }) @result end |