Sha256: 6bc4a70442d979c2fa315ba848bfaf344477ca57387c556b1f12815bc3b07bf3
Contents?: true
Size: 697 Bytes
Versions: 2
Compression:
Stored size: 697 Bytes
Contents
module RSpec::Rails module View include RSpec::Rails::App 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(view_dir, name.to_s, "#{action}.#{type}") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
generator-spec-0.4.5 | lib/generator_spec/rails_helpers/rails_view.rb |
generator-spec-0.4.4 | lib/generator_spec/rails_helpers/rails_view.rb |