Class: Ardb::AdapterSpy

Inherits:
Ardb::Adapter::Base show all
Defined in:
lib/ardb/adapter_spy.rb

Instance Attribute Summary collapse

Attributes inherited from Ardb::Adapter::Base

#config

Instance Method Summary collapse

Methods inherited from Ardb::Adapter::Base

#==, #connect_hash, #database, #dump_ruby_schema, #dump_sql_schema, #escape_like_pattern, #load_ruby_schema, #load_sql_schema, #migrate_db_backward, #migrate_db_down, #migrate_db_forward, #migrate_db_up, #migrations_path, #ruby_schema_path, #schema_format, #sql_schema_path

Constructor Details

#initialize(config = nil) ⇒ AdapterSpy

Returns a new instance of AdapterSpy.



13
14
15
16
17
18
19
20
21
22
# File 'lib/ardb/adapter_spy.rb', line 13

def initialize(config = nil)
  super(config || Ardb::Config.new)
  @drop_tables_called_count = 0
  @dump_schema_called_count = 0
  @load_schema_called_count = 0
  @drop_db_called_count     = 0
  @create_db_called_count   = 0
  @connect_db_called_count  = 0
  @migrate_db_called_count  = 0
end

Instance Attribute Details

#connect_db_called_countObject

Returns the value of attribute connect_db_called_count.



11
12
13
# File 'lib/ardb/adapter_spy.rb', line 11

def connect_db_called_count
  @connect_db_called_count
end

#create_db_called_countObject

Returns the value of attribute create_db_called_count.



10
11
12
# File 'lib/ardb/adapter_spy.rb', line 10

def create_db_called_count
  @create_db_called_count
end

#drop_db_called_countObject

Returns the value of attribute drop_db_called_count.



10
11
12
# File 'lib/ardb/adapter_spy.rb', line 10

def drop_db_called_count
  @drop_db_called_count
end

#drop_tables_called_countObject

Returns the value of attribute drop_tables_called_count.



8
9
10
# File 'lib/ardb/adapter_spy.rb', line 8

def drop_tables_called_count
  @drop_tables_called_count
end

#dump_schema_called_countObject

Returns the value of attribute dump_schema_called_count.



9
10
11
# File 'lib/ardb/adapter_spy.rb', line 9

def dump_schema_called_count
  @dump_schema_called_count
end

#load_schema_called_countObject

Returns the value of attribute load_schema_called_count.



9
10
11
# File 'lib/ardb/adapter_spy.rb', line 9

def load_schema_called_count
  @load_schema_called_count
end

#migrate_db_called_countObject

Returns the value of attribute migrate_db_called_count.



11
12
13
# File 'lib/ardb/adapter_spy.rb', line 11

def migrate_db_called_count
  @migrate_db_called_count
end

Instance Method Details

#connect_db(*_args) ⇒ Object



66
67
68
# File 'lib/ardb/adapter_spy.rb', line 66

def connect_db(*_args)
  self.connect_db_called_count += 1
end

#connect_db_called?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/ardb/adapter_spy.rb', line 36

def connect_db_called?
  connect_db_called_count > 0
end

#create_db(*_args) ⇒ Object

Overwritten `Adapter::Base` methods



54
55
56
# File 'lib/ardb/adapter_spy.rb', line 54

def create_db(*_args)
  self.create_db_called_count += 1
end

#create_db_called?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/ardb/adapter_spy.rb', line 24

def create_db_called?
  create_db_called_count > 0
end

#drop_db(*_args) ⇒ Object



58
59
60
# File 'lib/ardb/adapter_spy.rb', line 58

def drop_db(*_args)
  self.drop_db_called_count += 1
end

#drop_db_called?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/ardb/adapter_spy.rb', line 28

def drop_db_called?
  drop_db_called_count > 0
end

#drop_tables(*_args) ⇒ Object



62
63
64
# File 'lib/ardb/adapter_spy.rb', line 62

def drop_tables(*_args)
  self.drop_tables_called_count += 1
end

#drop_tables_called?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/ardb/adapter_spy.rb', line 32

def drop_tables_called?
  drop_tables_called_count > 0
end

#dump_schema(*_args) ⇒ Object



78
79
80
# File 'lib/ardb/adapter_spy.rb', line 78

def dump_schema(*_args)
  self.dump_schema_called_count += 1
end

#dump_schema_called?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/ardb/adapter_spy.rb', line 48

def dump_schema_called?
  dump_schema_called_count > 0
end

#load_schema(*_args) ⇒ Object



74
75
76
# File 'lib/ardb/adapter_spy.rb', line 74

def load_schema(*_args)
  self.load_schema_called_count += 1
end

#load_schema_called?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/ardb/adapter_spy.rb', line 44

def load_schema_called?
  load_schema_called_count > 0
end

#migrate_db(*_args) ⇒ Object



70
71
72
# File 'lib/ardb/adapter_spy.rb', line 70

def migrate_db(*_args)
  self.migrate_db_called_count += 1
end

#migrate_db_called?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/ardb/adapter_spy.rb', line 40

def migrate_db_called?
  migrate_db_called_count > 0
end