File: authentication_generator.rb

package info (click to toggle)
ruby-rspec-rails 8.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,820 kB
  • sloc: ruby: 10,902; sh: 199; makefile: 6
file content (25 lines) | stat: -rw-r--r-- 530 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'generators/rspec'

module Rspec
  module Generators
    # @private
    class AuthenticationGenerator < Base
      def initialize(args, *options)
        args.replace(['User'])
        super
      end

      def create_user_spec
        template 'user_spec.rb', target_path('models', 'user_spec.rb')
      end

      hook_for :fixture_replacement

      def create_fixture_file
        return if options[:fixture_replacement]

        template 'users.yml', target_path('fixtures', 'users.yml')
      end
    end
  end
end