Sha256: 04b8a65504a0599a5feb21c834b3548a02d1de20f297bbd2ad23ddc5f745f1ad
Contents?: true
Size: 669 Bytes
Versions: 4
Compression:
Stored size: 669 Bytes
Contents
module RSpec::Rails module View def create_view name, action, type, content=nil file = view_file_name(name, action, type) unless File.exist?(file) FileUtils.mkdir_p File.dirname(file) content ||= yield if block_given? return if !content File.open(file, 'w') do |f| f.puts content end end end def remove_view name, action, type file = view_file_name(name, action, type) FileUtils.rm_f(file) if File.exist?(file) end def view_file_name name, action, type File.join(::Rails.root, "app/views/#{name}/#{action}.#{type}") end end end
Version data entries
4 entries across 4 versions & 1 rubygems