Sha256: 969e5508e37b67eb43067bef91fd53b3ec7f65eb0876f7b6ac3d51f23d814b2b

Contents?: true

Size: 831 Bytes

Versions: 2

Compression:

Stored size: 831 Bytes

Contents

require 'generators/rspec'
require "rspec/rails/feature_check"

module Rspec
  module Generators
    # @private
    class MailerGenerator < Base
      argument :actions, :type => :array, :default => [], :banner => "method method"

      def generate_mailer_spec
        template "mailer_spec.rb", File.join('spec/mailers', class_path, "#{file_name}_spec.rb")
      end

      def generate_fixtures_files
        actions.each do |action|
          @action, @path = action, File.join(file_path, action)
          template "fixture", File.join("spec/fixtures", @path)
        end
      end

      def generate_preview_files
        return unless RSpec::Rails::FeatureCheck.has_action_mailer_preview?

        template "preview.rb", File.join("spec/mailers/previews", class_path, "#{file_name}_preview.rb")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-rails-4.0.0.beta3 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-4.0.0.beta2 lib/generators/rspec/mailer/mailer_generator.rb