Sha256: 989b82ebf679989b3ba6a8f4cbf78330b944fb12148eb06274515ddf1072ab2d

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

Contents

require 'helper'
require 'active_record'
require 'rails/generators/test_case'
require 'generators/flipper/active_record_generator'

class FlipperActiveRecordGeneratorTest < Rails::Generators::TestCase
  tests Flipper::Generators::ActiveRecordGenerator
  destination File.expand_path("../../../../tmp", __FILE__)
  setup :prepare_destination

  def test_generates_migration
    run_generator
    assert_migration "db/migrate/create_flipper_tables.rb", <<-EOM
class CreateFlipperTables < ActiveRecord::Migration
  def self.up
    create_table :flipper_features do |t|
      t.string :key, null: false
      t.timestamps null: false
    end
    add_index :flipper_features, :key, unique: true

    create_table :flipper_gates do |t|
      t.string :feature_key, null: false
      t.string :key, null: false
      t.string :value
      t.timestamps null: false
    end
    add_index :flipper_gates, [:feature_key, :key, :value], unique: true
  end

  def self.down
    drop_table :flipper_gates
    drop_table :flipper_features
  end
end
EOM
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
flipper-active_record-0.10.2 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.10.1 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.10.0 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.9.2 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.9.1 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.9.0 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.9.0.beta1 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.8.0 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.7.5 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.7.4 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.7.3 test/generators/flipper/active_record_generator_test.rb