Sha256: b2c9def97f0ab2c80fcb8154cb760310102fdc5350256fc34a2f8586543c4586
Contents?: true
Size: 670 Bytes
Versions: 1
Compression:
Stored size: 670 Bytes
Contents
module RSpec::Rails module Model def create_model name, type=nil, &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, type) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
generator-spec-0.4.3 | lib/rspec_for_generators/rails_helpers/rails_model.rb |