test/install_generator_test.rb in audited-4.4.1 vs test/install_generator_test.rb in audited-4.5.0
- old
+ new
@@ -32,9 +32,27 @@
assert_includes(content, 'class InstallAudited')
assert_includes(content, 't.column :audited_changes, :json')
end
end
+ test "generate migration with 'string' type for user_id column" do
+ run_generator %w(--audited-user-id-column-type string)
+
+ assert_migration "db/migrate/install_audited.rb" do |content|
+ assert_includes(content, 'class InstallAudited')
+ assert_includes(content, 't.column :user_id, :string')
+ end
+ end
+
+ test "generate migration with 'uuid' type for user_id column" do
+ run_generator %w(--audited-user-id-column-type uuid)
+
+ assert_migration "db/migrate/install_audited.rb" do |content|
+ assert_includes(content, 'class InstallAudited')
+ assert_includes(content, 't.column :user_id, :uuid')
+ end
+ end
+
test "generate migration with correct AR migration parent" do
run_generator
assert_migration "db/migrate/install_audited.rb" do |content|
parent = Rails::VERSION::MAJOR == 4 ? 'ActiveRecord::Migration' : "ActiveRecord::Migration[#{ActiveRecord::Migration.current_version}]"