Sha256: d06f42eb2be3157354102ba2e5a4e660fe0b98c09450222a45bad1916ce20953
Contents?: true
Size: 1.27 KB
Versions: 7
Compression:
Stored size: 1.27 KB
Contents
require 'spec_helper' require 'generators/active_record/two_factor_authentication_generator' describe ActiveRecord::Generators::TwoFactorAuthenticationGenerator, type: :generator do destination File.expand_path('../../../../../tmp', __FILE__) before do prepare_destination end it 'runs all methods in the generator' do gen = generator %w(users) expect(gen).to receive(:copy_two_factor_authentication_migration) gen.invoke_all end describe 'the generated files' do before do run_generator %w(users) end describe 'the migration' do subject { migration_file('db/migrate/two_factor_authentication_add_to_users.rb') } it { is_expected.to exist } it { is_expected.to be_a_migration } it { is_expected.to contain /def change/ } it { is_expected.to contain /add_column :users, :second_factor_attempts_count, :integer, default: 0/ } it { is_expected.to contain /add_column :users, :encrypted_otp_secret_key, :string/ } it { is_expected.to contain /add_column :users, :encrypted_otp_secret_key_iv, :string/ } it { is_expected.to contain /add_column :users, :encrypted_otp_secret_key_salt, :string/ } it { is_expected.to contain /add_index :users, :encrypted_otp_secret_key, unique: true/ } end end end
Version data entries
7 entries across 7 versions & 2 rubygems