Sha256: 3519cd3f0bf40ffbe860b29c04bee3a2854f3757c3e259e5de71eb0b7496bebf
Contents?: true
Size: 670 Bytes
Versions: 3
Compression:
Stored size: 670 Bytes
Contents
module RSpec::Rails module View def create_view name, content=nil file = view_file_name(name) 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 file = view_file_name(name) FileUtils.rm_f(file) if File.exist?(file) end def remove_views *names names.each{|name| remove_view name } end def view_file_name name File.join(::Rails.root, "app/views/#{name}.rb") end end end
Version data entries
3 entries across 3 versions & 1 rubygems