Class: MigrationValidators::Spec::Matchers::DBMatchers::Deny

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



153
154
155
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 153

def check_result value, exception, operation
  super && exception && exception.message =~ /#{message}/
end

#descriptionObject



157
158
159
160
161
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 157

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

#failure_messageObject



164
165
166
167
168
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 164

def failure_message
  compose_message do |operations_name, elements_name, last_message, expected_message|
   "expected that operation #{operations_name} would fail for #{elements_name} from #{values} #{expected_message}. But #{last_operation} #{last_message.blank? ? 'successed with ' : 'raised ' + last_message + ' for '}'#{last_value}'"
  end
end

#failure_message_when_negatedObject



170
171
172
173
174
# File 'lib/migration_validators/spec/matchers/db_matchers.rb', line 170

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