Sha256: 1bd93a7381ad357bc67e64acabc1714073112223871d2726a46e7a6c15127435

Contents?: true

Size: 1.02 KB

Versions: 8

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

8 entries across 8 versions & 1 rubygems

Version Path
flipper-active_record-0.11.0.beta9 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta8 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta7 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta6 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta5 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta4 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta3 test/generators/flipper/active_record_generator_test.rb
flipper-active_record-0.11.0.beta1 test/generators/flipper/active_record_generator_test.rb