Class: Spec::Matchers::Migration::HaveColumnMatcher
- Inherits:
-
Object
- Object
- Spec::Matchers::Migration::HaveColumnMatcher
- Defined in:
- lib/spec/matchers/migration_matchers.rb
Instance Attribute Summary (collapse)
-
- (Object) column_name
Returns the value of attribute column_name.
-
- (Object) table
Returns the value of attribute table.
Instance Method Summary (collapse)
- - (Object) failure_message
-
- (HaveColumnMatcher) initialize(column_name)
constructor
A new instance of HaveColumnMatcher.
- - (Boolean) matches?(table)
- - (Object) negative_failure_message
Constructor Details
- (HaveColumnMatcher) initialize(column_name)
A new instance of HaveColumnMatcher
47 48 49 |
# File 'lib/spec/matchers/migration_matchers.rb', line 47 def initialize(column_name) @column_name = column_name end |
Instance Attribute Details
- (Object) column_name
Returns the value of attribute column_name
45 46 47 |
# File 'lib/spec/matchers/migration_matchers.rb', line 45 def column_name @column_name end |
- (Object) table
Returns the value of attribute table
45 46 47 |
# File 'lib/spec/matchers/migration_matchers.rb', line 45 def table @table end |
Instance Method Details
- (Object) failure_message
56 57 58 |
# File 'lib/spec/matchers/migration_matchers.rb', line 56 def %(expected #{table} to have column '#{column_name}') end |
- (Boolean) matches?(table)
51 52 53 54 |
# 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 |
- (Object) negative_failure_message
60 61 62 |
# File 'lib/spec/matchers/migration_matchers.rb', line 60 def %(expected #{table} to not have column '#{column_name}') end |