Sha256: c9be20003c39aa960f7c0851c2d803d28b322c5ece25b1a95af53120e96d4cf4
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
module CukeModeler module FileHelper class << self def create_feature_file(options = {}) options[:text] ||= 'Feature:' options[:name] ||= 'test_file' create_file(:text => options[:text], :name => options[:name], :extension => '.feature', :directory => options[:directory]) end def create_file(options = {}) options[:text] ||= '' options[:name] ||= 'test_file' options[:extension] ||= '.txt' options[:directory] ||= create_directory file_path = "#{options[:directory]}/#{options[:name]}#{options[:extension]}" File.open(file_path, 'w') { |file| file.write(options[:text]) } file_path end def created_directories @created_directories ||= [] end def create_directory(options = {}) options[:name] ||= 'test_directory' options[:directory] ||= Dir.mktmpdir path = "#{options[:directory]}/#{options[:name]}" Dir::mkdir(path) created_directories << options[:directory] path end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cuke_modeler-1.3.0 | testing/file_helper.rb |