Class: MySQLExpectations::Matchers::TableHaveCollation
- Inherits:
-
Object
- Object
- MySQLExpectations::Matchers::TableHaveCollation
- Defined in:
- lib/mysql_expectations/matchers/table_have_collation.rb
Overview
A matcher that checks a table’s collation
Instance Attribute Summary collapse
-
#expected_collation ⇒ Object
readonly
Returns the value of attribute expected_collation.
-
#table ⇒ Object
readonly
Returns the value of attribute table.
Instance Method Summary collapse
- #actual_collation ⇒ Object
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(expected_collation) ⇒ TableHaveCollation
constructor
A new instance of TableHaveCollation.
- #matches?(table) ⇒ Boolean
Constructor Details
#initialize(expected_collation) ⇒ TableHaveCollation
Returns a new instance of TableHaveCollation.
12 13 14 15 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 12 def initialize(expected_collation) @expected_collation = expected_collation @table = nil end |
Instance Attribute Details
#expected_collation ⇒ Object (readonly)
Returns the value of attribute expected_collation.
10 11 12 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 10 def expected_collation @expected_collation end |
#table ⇒ Object (readonly)
Returns the value of attribute table.
10 11 12 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 10 def table @table end |
Instance Method Details
#actual_collation ⇒ Object
17 18 19 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 17 def actual_collation table.collation end |
#description ⇒ Object
26 27 28 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 26 def description "have collation '#{expected_collation}'" end |
#failure_message ⇒ Object
30 31 32 33 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 30 def "expected '#{table.name}' table to have collation " \ "'#{expected_collation}' but it was '#{table.collation}'" end |
#matches?(table) ⇒ Boolean
21 22 23 24 |
# File 'lib/mysql_expectations/matchers/table_have_collation.rb', line 21 def matches?(table) @table = table actual_collation == expected_collation end |