test/generators/views_generator_test.rb in devise-3.2.3 vs test/generators/views_generator_test.rb in devise-3.2.4
- old
+ new
@@ -31,10 +31,39 @@
assert_file "app/views/users/confirmations/new.html.erb", /simple_form_for/
end
test "Assert views with markerb" do
run_generator %w(--markerb)
- assert_files nil, :mail_template_engine => "markerb"
+ assert_files nil, mail_template_engine: "markerb"
+ end
+
+
+ test "Assert only views within specified directories" do
+ run_generator %w(-v 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_no_file "app/views/devise/mailer/confirmation_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"
+ assert_no_file "app/views/users/confirmations/new.html.erb"
+ end
+
+ test "Assert specified directories with simple form" do
+ run_generator %w(-v registrations -b simple_form_for)
+ assert_file "app/views/devise/registrations/new.html.erb", /simple_form_for/
+ assert_no_file "app/views/devise/confirmations/new.html.erb"
+ end
+
+ test "Assert specified directories with markerb" do
+ run_generator %w(--markerb -v passwords mailer)
+ assert_file "app/views/devise/passwords/new.html.erb"
+ assert_no_file "app/views/devise/confirmations/new.html.erb"
+ assert_file "app/views/devise/mailer/reset_password_instructions.markerb"
end
def assert_files(scope = nil, options={})
scope = "devise" if scope.nil?
mail_template_engine = options[:mail_template_engine] || "html.erb"