Module: ActiveGroonga::TestFixtures

Included in:
ActiveSupport::TestCase
Defined in:
lib/active_groonga/fixtures.rb

Defined Under Namespace

Classes: ConnectionMock

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



19
20
21
22
23
24
# File 'lib/active_groonga/fixtures.rb', line 19

def included(base)
  base.class_eval do
    alias_method_chain :setup_fixtures, :active_groonga
    alias_method_chain :teardown_fixtures, :active_groonga
  end
end

Instance Method Details

#load_active_groonga_fixturesObject



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/active_groonga/fixtures.rb', line 40

def load_active_groonga_fixtures
  @loaded_fixtures ||= {}
  fixtures = Fixtures.create_fixtures(fixture_path, fixture_table_names, fixture_class_names) do
    ConnectionMock.new
  end
  unless fixtures.nil?
    if fixtures.instance_of?(Fixtures)
      @loaded_fixtures[fixtures.name] = fixtures
    else
      fixtures.each { |f| @loaded_fixtures[f.name] = f }
    end
  end
end

#setup_fixtures_with_active_groongaObject



27
28
29
30
31
32
33
34
# File 'lib/active_groonga/fixtures.rb', line 27

def setup_fixtures_with_active_groonga
  setup_fixtures_without_active_groonga

  @fixture_cache ||= {}
  @@already_loaded_fixtures ||= {}

  load_active_groonga_fixtures
end

#teardown_fixtures_with_active_groongaObject



36
37
38
# File 'lib/active_groonga/fixtures.rb', line 36

def teardown_fixtures_with_active_groonga
  teardown_fixtures_without_active_groonga
end