Sha256: aeae4313d099d23a5886899cf71f526faf57d3406cd77b603b74ed523088d6aa
Contents?: true
Size: 1.57 KB
Versions: 2
Compression:
Stored size: 1.57 KB
Contents
require 'test_helper' require 'generators/audited/install_generator' class InstallGeneratorTest < Rails::Generators::TestCase destination File.expand_path('../../tmp', __FILE__) setup :prepare_destination tests Audited::Generators::InstallGenerator test "generate migration with 'text' type for audited_changes column" do run_generator assert_migration "db/migrate/install_audited.rb" do |content| assert_includes(content, 'class InstallAudited') assert_includes(content, 't.column :audited_changes, :text') end end test "generate migration with 'jsonb' type for audited_changes column" do run_generator %w(--audited-changes-column-type jsonb) assert_migration "db/migrate/install_audited.rb" do |content| assert_includes(content, 'class InstallAudited') assert_includes(content, 't.column :audited_changes, :jsonb') end end test "generate migration with 'json' type for audited_changes column" do run_generator %w(--audited-changes-column-type json) assert_migration "db/migrate/install_audited.rb" do |content| assert_includes(content, 'class InstallAudited') assert_includes(content, 't.column :audited_changes, :json') 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}]" assert_includes(content, "class InstallAudited < #{parent}\n") end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
audited-4.4.1 | test/install_generator_test.rb |
audited-4.4.0 | test/install_generator_test.rb |