Class: RspecSequel::Matchers::ValidateUniqueMatcher

Inherits:
Validation show all
Defined in:
lib/rspec_sequel/matchers/validate_unique.rb

Instance Method Summary collapse

Methods inherited from Validation

#additionnal_param_required?, #additionnal_param_type, #initialize, #valid?

Methods inherited from Base

#failure_message, #hash_to_nice_string, #initialize, #matches?, #negative_failure_message

Constructor Details

This class inherits a constructor from RspecSequel::Validation

Instance Method Details

#args_to_called_attributes(args) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/rspec_sequel/matchers/validate_unique.rb', line 19

def args_to_called_attributes(args)
  called_attributes = []
  until args.empty?
    called_attributes << args.shift
  end
  called_attributes
end

#descriptionObject



5
6
7
8
9
# File 'lib/rspec_sequel/matchers/validate_unique.rb', line 5

def description
  desc = "validate uniqueness of #{@attribute.inspect}"
  desc << " with option(s) #{hash_to_nice_string @options}" unless @options.empty?
  desc
end

#valid_optionsObject



15
16
17
# File 'lib/rspec_sequel/matchers/validate_unique.rb', line 15

def valid_options
  [:message]
end

#validation_typeObject



11
12
13
# File 'lib/rspec_sequel/matchers/validate_unique.rb', line 11

def validation_type
  :validates_unique
end