Sha256: a48787274655c5bfc68c9ee720b8c17acce69c9433bbda752d74043329a6ba38

Contents?: true

Size: 693 Bytes

Versions: 9

Compression:

Stored size: 693 Bytes

Contents

module EdgeRider
  module Development
    extend self

    def drop_all_tables
      connection = ::ActiveRecord::Base.connection
      connection.tables.each do |table|
        connection.drop_table table
      end
    end

    def migrate_test_database
      print "\033[30m" # dark gray text
      drop_all_tables
      ::ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")
      print "\033[0m"
    end

    def selects_star_with_conditions_pattern(table, conditions)
      table = Regexp.quote(table)
      conditions = Regexp.quote(conditions) unless conditions.is_a?(Regexp)
      /\ASELECT (`#{table}`\.)?\* FROM `#{table}`\s+WHERE \(?#{conditions}\)?\s*\z/
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
edge_rider-0.3.1 lib/edge_rider/development.rb
edge_rider-0.3.0 lib/edge_rider/development.rb
edge_rider-0.2.5 lib/edge_rider/development.rb
edge_rider-0.2.4 lib/edge_rider/development.rb
edge_rider-0.2.3 lib/edge_rider/development.rb
edge_rider-0.2.2 lib/edge_rider/development.rb
edge_rider-0.2.1 lib/edge_rider/development.rb
edge_rider-0.2.0 lib/edge_rider/development.rb
edge_rider-0.1.1 lib/edge_rider/development.rb