Fix rails g devise:views -v mailer with the Simple Form generator.

Our Simple Form generator shouldn't be responsible for generating the `mailer`
view directory, so we should skip it and let the Erb generator do the job.

Closes #3254.
This commit is contained in:
Lucas Mazza
2015-08-27 12:12:13 -03:00
parent fb3568308e
commit eb091b867f
2 changed files with 14 additions and 0 deletions

View File

@@ -83,6 +83,13 @@ module Devise
source_root File.expand_path("../../templates/simple_form_for", __FILE__)
desc "Copies simple form enabled views to your application."
hide!
def copy_views
if options[:views]
options[:views].delete('mailer')
end
super
end
end
class ErbGenerator < Rails::Generators::Base #:nodoc:

View File

@@ -46,6 +46,13 @@ class ViewsGeneratorTest < Rails::Generators::TestCase
assert_no_file "app/views/devise/mailer/confirmation_instructions.html.erb"
end
test "Assert mailer specific directory with simple form" do
run_generator %w(-v mailer -b simple_form_for)
assert_file "app/views/devise/mailer/confirmation_instructions.html.erb"
assert_file "app/views/devise/mailer/reset_password_instructions.html.erb"
assert_file "app/views/devise/mailer/unlock_instructions.html.erb"
end
test "Assert specified directories with scope" do
run_generator %w(users -v sessions)
assert_file "app/views/users/sessions/new.html.erb"