Sha256: 2fa163a517709c4a9c2dba3ad8f0047882f25d309ceee2c03416dc08b6e2b216
Contents?: true
Size: 654 Bytes
Versions: 6
Compression:
Stored size: 654 Bytes
Contents
module RSpec::Rails module Model def create_model name, &block file = model_file_name(name) unless File.exist?(file) FileUtils.mkdir_p File.dirname(file) File.open(file, 'w') do |f| f.puts file_content(name) yield f if block_given? end end end def remove_model name file = model_file_name(name) FileUtils.rm_f(file) if File.exist?(file) end def remove_models *names names.each{|name| remove_model name } end def model_file_name name File.join(::Rails.root, "app/models/#{name}.rb") end end end
Version data entries
6 entries across 6 versions & 1 rubygems