class MySQLExpectations::Field

Allows assertions on a database

Public Class Methods

new(field_element) click to toggle source
# File lib/mysql_expectations/field.rb, line 9
def initialize(field_element)
  @field_element = field_element
end

Public Instance Methods

definition?(expected_options) click to toggle source
# File lib/mysql_expectations/field.rb, line 17
def definition?(expected_options)
  expected_options.each do |expected_key, expected_value|
    value = @field_element.attributes[expected_key]
    return false if value.nil? || value != expected_value
  end
  true
end
Also aliased as: has_definition?
has_definition?(expected_options)
Alias for: definition?
has_type?(expected_type)
Alias for: type?
name() click to toggle source
# File lib/mysql_expectations/field.rb, line 13
def name
  @field_element.attributes['Field']
end
nullable?() click to toggle source
# File lib/mysql_expectations/field.rb, line 37
def nullable?
  @field_element.attributes['Null'] == 'YES'
end
type() click to toggle source
# File lib/mysql_expectations/field.rb, line 27
def type
  @field_element.attributes['Type']
end
type?(expected_type) click to toggle source
# File lib/mysql_expectations/field.rb, line 31
def type?(expected_type)
  expected_type == type
end
Also aliased as: has_type?