Class: TestUnit::Generators::AuthenticationGenerator

Inherits:
Rails::Generators::Base show all
Defined in:
lib/rails/generators/test_unit/authentication/authentication_generator.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Rails::Generators::Base

add_shebang_option!, banner, base_name, base_root, class_option, default_aliases_for_option, default_for_option, default_generator_root, default_source_root, default_value_for_option, desc, exit_on_failure?, generator_name, hide!, hook_for, hooks, inherited, namespace, prepare_for_invocation, remove_hook_for, source_root, usage_path

Methods included from Rails::Generators::Actions

#add_source, #environment, #gem, #gem_group, #generate, #git, #github, #initialize, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor

Instance Method Details

#configure_test_helperObject



26
27
28
# File 'lib/rails/generators/test_unit/authentication/authentication_generator.rb', line 26

def configure_test_helper
  inject_into_file "test/test_helper.rb", "require_relative \"test_helpers/session_test_helper\"\n", after: "require \"rails/test_help\"\n"
end

#create_controller_test_filesObject



13
14
15
16
# File 'lib/rails/generators/test_unit/authentication/authentication_generator.rb', line 13

def create_controller_test_files
  template "test/controllers/sessions_controller_test.rb"
  template "test/controllers/passwords_controller_test.rb"
end

#create_mailer_preview_filesObject



18
19
20
# File 'lib/rails/generators/test_unit/authentication/authentication_generator.rb', line 18

def create_mailer_preview_files
  template "test/mailers/previews/passwords_mailer_preview.rb" if defined?(ActionMailer::Railtie)
end

#create_test_helper_filesObject



22
23
24
# File 'lib/rails/generators/test_unit/authentication/authentication_generator.rb', line 22

def create_test_helper_files
  template "test/test_helpers/session_test_helper.rb"
end

#create_user_test_filesObject



8
9
10
11
# File 'lib/rails/generators/test_unit/authentication/authentication_generator.rb', line 8

def create_user_test_files
  template "test/fixtures/users.yml"
  template "test/models/user_test.rb"
end