Sha256: 1fb04f8c344364ed9ba52cda6b2e1292b58f25a7adee496bc177d6c9dc61668e

Contents?: true

Size: 830 Bytes

Versions: 37

Compression:

Stored size: 830 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

37 entries across 37 versions & 5 rubygems

Version Path
rspec-rails-3.9.1 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.8.3 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.9.0 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.8.2 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.8.1 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.8.0 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.7.2 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.7.1 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.7.0 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.6.1 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.6.0 lib/generators/rspec/mailer/mailer_generator.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/rspec-rails-3.5.2/lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.6.0.beta2 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.6.0.beta1 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.5.2 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.5.1 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.5.0 lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.5.0.beta4 lib/generators/rspec/mailer/mailer_generator.rb
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/rspec-rails-3.4.2/lib/generators/rspec/mailer/mailer_generator.rb
rspec-rails-3.5.0.beta3 lib/generators/rspec/mailer/mailer_generator.rb