Class: MySQLExpectations::Matchers::DatabaseHaveTable
- Inherits:
-
Object
- Object
- MySQLExpectations::Matchers::DatabaseHaveTable
- Defined in:
- lib/mysql_expectations/matchers/database_have_table.rb
Overview
A matcher that checks a table’s collation
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#expected_table ⇒ Object
readonly
Returns the value of attribute expected_table.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
-
#initialize(expected_table) ⇒ DatabaseHaveTable
constructor
A new instance of DatabaseHaveTable.
- #matches?(database) ⇒ Boolean
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
#database ⇒ Object (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_table ⇒ Object (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
#description ⇒ Object
22 23 24 |
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 22 def description "have table '#{expected_table}'" end |
#failure_message ⇒ Object
26 27 28 29 |
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 26 def "expected '#{database.name}' database to have table " \ "'#{expected_table}'" end |
#failure_message_when_negated ⇒ Object
31 32 33 34 |
# File 'lib/mysql_expectations/matchers/database_have_table.rb', line 31 def "expected '#{database.name}' database not to have table " \ "'#{expected_table}'" end |
#matches?(database) ⇒ 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 |