Sha256: a102dfd90c7def17c253a5e5b2dd824c3ea01f39480ed64437bf1f8e140a08a3
Contents?: true
Size: 1.13 KB
Versions: 5
Compression:
Stored size: 1.13 KB
Contents
require 'tmpdir' 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
5 entries across 5 versions & 1 rubygems