mirror of
https://github.com/heartcombo/devise.git
synced 2026-01-10 08:08:00 -05:00
WIP
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
require 'rails/generators/base'
|
||||
require 'thor/base'
|
||||
|
||||
module Devise
|
||||
module Generators
|
||||
@@ -28,6 +29,7 @@ module Devise
|
||||
end
|
||||
|
||||
def copy_views
|
||||
puts options
|
||||
view_directory :confirmations
|
||||
view_directory :passwords
|
||||
view_directory :registrations
|
||||
@@ -110,6 +112,12 @@ module Devise
|
||||
argument :scope, required: false, default: nil,
|
||||
desc: "The scope to copy views to"
|
||||
|
||||
method_options :specified_directories, required: false,
|
||||
aliases: "-S",
|
||||
desc: "Specify a subset of views to generate",
|
||||
default: nil,
|
||||
type: :array
|
||||
|
||||
invoke SharedViewsGenerator
|
||||
|
||||
hook_for :form_builder, aliases: "-b",
|
||||
|
||||
@@ -36,6 +36,17 @@ class ViewsGeneratorTest < Rails::Generators::TestCase
|
||||
assert_files nil, mail_template_engine: "markerb"
|
||||
end
|
||||
|
||||
|
||||
test "Assert only views within specified directories" do
|
||||
run_generator %w(-d sessions, registrations)
|
||||
assert_file "app/views/devise/sessions/new.html.erb"
|
||||
assert_file "app/views/devise/registrations/new.html.erb"
|
||||
assert_file "app/views/devise/registrations/edit.html.erb"
|
||||
assert_no_file "app/views/devise/confirmations/new.html.erb"
|
||||
|
||||
#assert_shared_links
|
||||
end
|
||||
|
||||
def assert_files(scope = nil, options={})
|
||||
scope = "devise" if scope.nil?
|
||||
mail_template_engine = options[:mail_template_engine] || "html.erb"
|
||||
|
||||
Reference in New Issue
Block a user