class ActiveGroonga::TestFixtures::ConnectionMock

Public Class Methods

new() click to toggle source
# File lib/active_groonga/fixtures.rb, line 55
def initialize
  @last_quoted_table_name = nil
end

Public Instance Methods

delete(sql, name=nil) click to toggle source
# File lib/active_groonga/fixtures.rb, line 72
def delete(sql, name=nil)
  if @last_quoted_table_name
    Base.context[@last_quoted_table_name].truncate
  end
end
disable_referential_integrity() { || ... } click to toggle source
# File lib/active_groonga/fixtures.rb, line 59
def disable_referential_integrity
  yield
end
insert_fixture(fixture, table_name) click to toggle source
# File lib/active_groonga/fixtures.rb, line 78
def insert_fixture(fixture, table_name)
  table = Base.context[Base.groonga_table_name(table_name)]
  record = table.add

  row = fixture.to_hash

  fixture.each do |key, value|
    record[key] = value
  end

  row[fixture.model_class.primary_key] = record.id
end
quote_table_name(table_name) click to toggle source
# File lib/active_groonga/fixtures.rb, line 67
def quote_table_name(table_name)
  @last_quoted_table_name = Base.groonga_table_name(table_name)
  table_name
end
transaction(options=nil) { || ... } click to toggle source
# File lib/active_groonga/fixtures.rb, line 63
def transaction(options=nil)
  yield
end