Class: MigrationValidators::Spec::Matchers::DBMatchers::Allow

Inherits:
BaseDbMatcher
  • Object
show all
Defined in:
lib/migration_validators/spec/matchers/db_matchers.rb

Instance Method Summary collapse

Methods inherited from BaseDbMatcher

#all, #all?, #at_least_one, #at_least_one?, #from, #initial, #initialize, #insert, #insert?, #matches?, #message, #operations_array, #update, #update?, #update_and_insert, #values, #with_message

Constructor Details

This class inherits a constructor from MigrationValidators::Spec::Matchers::DBMatchers::BaseDbMatcher

Instance Method Details

#check_result(value, exception, operation) ⇒ Object



179
180
181
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 179

def check_result value, exception, operation
  super && exception.blank?
end

#descriptionObject



183
184
185
186
187
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 183

def description
  compose_message do |operations_name, elements_name, last_message, expected_message|
   "expected that operation #{operations_name} would success for #{elements_name} from #{values}"
  end
end

#failure_messageObject



189
190
191
192
193
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 189

def failure_message
  compose_message do |operations_name, elements_name, last_message, expected_message|
   "expected that operation #{operations_name} would success for #{elements_name} from #{values}. But #{last_operation} raised #{last_message} for '#{last_value}'"
  end
end

#failure_message_when_negatedObject



195
196
197
198
199
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 195

def failure_message_when_negated
  compose_message do |operations_name, elements_name, last_message, expected_message|
   "not expected that operation #{operations_name} would success for #{elements_name} from #{values}. But it happened with #{last_operation} on '#{last_value}'"
  end
end