Class: MySQLExpectations::Matchers::DatabaseHaveTable

Inherits:
Object
  • Object
show all
Defined in:
lib/mysql_expectations/matchers/database_have_table.rb

Overview

A matcher that checks a table’s collation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expected_table) ⇒ DatabaseHaveTable

Returns a new instance of DatabaseHaveTable.



12
13
14
15
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 12

def initialize(expected_table)
  @expected_table = expected_table
  @table = nil
end

Instance Attribute Details

#databaseObject (readonly)

Returns the value of attribute database.



10
11
12
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 10

def database
  @database
end

#expected_tableObject (readonly)

Returns the value of attribute expected_table.



10
11
12
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 10

def expected_table
  @expected_table
end

Instance Method Details

#descriptionObject



22
23
24
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 22

def description
  "have table '#{expected_table}'"
end

#failure_messageObject



26
27
28
29
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 26

def failure_message
  "expected '#{database.name}' database to have table " \
    "'#{expected_table}'"
end

#failure_message_when_negatedObject



31
32
33
34
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 31

def failure_message_when_negated
  "expected '#{database.name}' database not to have table " \
    "'#{expected_table}'"
end

#matches?(database) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 17

def matches?(database)
  @database = database
  database.table?(expected_table)
end