Sha256: c229beb28cf9fc1bb56de823c33821bec6ea6fbc6770683866f6e369c4c4a44d

Contents?: true

Size: 726 Bytes

Versions: 4

Compression:

Stored size: 726 Bytes

Contents

module RSpec::Rails
  module Mailer 
    include RSpec::Rails::App    
    
    def create_mailer name, content=nil
      file = mailer_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_mailer name
      file = mailer_file_name(name)
      FileUtils.rm_f(file) if File.exist?(file)
    end

    def remove_mailers *names
      names.each{|name| remove_mailer name }
    end      
    
    def mailer_file_name name
      File.join(mailer_dir, "#{name}.rb")
    end        
    
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
generator-spec-0.4.8 lib/generator_spec/rails_helpers/rails_mailer.rb
generator-spec-0.4.7 lib/generator_spec/rails_helpers/rails_mailer.rb
generator-spec-0.4.5 lib/generator_spec/rails_helpers/rails_mailer.rb
generator-spec-0.4.4 lib/generator_spec/rails_helpers/rails_mailer.rb