module MySQLExpectations

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

rubocop:disable Style/PredicateName

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Copyright © 2015 Yahoo Inc. Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.

Public Instance Methods

has_table?(name)
Alias for: table?
method_missing(method, *arguments, &block) click to toggle source
Calls superclass method
# File lib/mysql_expectations/database.rb, line 43
def method_missing(method, *arguments, &block)
  if arguments.empty? && block.nil?
    table_name = method.to_s
    return table(table_name) if table?(table_name)
  end
  super
end
name() click to toggle source
# File lib/mysql_expectations/database.rb, line 17
def name
  @database_element.attributes['name']
end
respond_to_missing?(method, *) click to toggle source
Calls superclass method
# File lib/mysql_expectations/database.rb, line 51
def respond_to_missing?(method, *)
  table?(method.to_s) || super
end
table(name) click to toggle source
# File lib/mysql_expectations/database.rb, line 28
def table(name)
  query = "table_structure[@name='#{name}']"
  table_element = @database_element.elements[query]
  Table.new table_element if table_element
end
table?(name) click to toggle source
# File lib/mysql_expectations/database.rb, line 21
def table?(name)
  query = "table_structure[@name='#{name}']"
  !@database_element.elements[query].nil?
end
Also aliased as: has_table?
tables() click to toggle source
# File lib/mysql_expectations/database.rb, line 34
def tables
  query = 'table_structure'
  tables = []
  @database_element.elements.each(query) do |table_element|
    tables << Table.new(table_element)
  end
  tables
end