class Spec::Matchers::Migration::HaveColumnMatcher

Attributes

column_name[RW]
table[RW]

Public Class Methods

new(column_name) click to toggle source
# File lib/spec/matchers/migration_matchers.rb, line 47
def initialize(column_name)
  @column_name = column_name
end

Public Instance Methods

failure_message() click to toggle source
# File lib/spec/matchers/migration_matchers.rb, line 56
def failure_message
  %(expected #{table} to have column '#{column_name}')
end
matches?(table) click to toggle source
# File lib/spec/matchers/migration_matchers.rb, line 51
def matches?(table)
  @table = table
  table.columns.map { |c| c.name }.include?(column_name.to_s)
end
negative_failure_message() click to toggle source
# File lib/spec/matchers/migration_matchers.rb, line 60
def negative_failure_message
  %(expected #{table} to not have column '#{column_name}')
end