class ExampleSpecGenerator
Generates the propetires.yml to be used in tests
Public Class Methods
new(root_path = nil)
click to toggle source
# File lib/serverspec_launcher/generators/example_spec_generator.rb, line 6 def initialize(root_path = nil) @path = root_path ? "#{root_path}/" : '' @template_path = File.expand_path('../../../../templates', __FILE__) @spec_file = "#{@path}spec/example_spec.rb" end
Public Instance Methods
generate()
click to toggle source
# File lib/serverspec_launcher/generators/example_spec_generator.rb, line 16 def generate renderer = ERB.new template Dir.mkdir "#{@path}spec" unless Dir.exists? "#{@path}spec" File.open(@spec_file, 'w') { |file| file.write renderer.result } unless File.exists? @spec_file end
template()
click to toggle source
# File lib/serverspec_launcher/generators/example_spec_generator.rb, line 12 def template File.read "#{@template_path}/example_spec.rb.erb" end