Class: ErgomentumRspec::Matchers::Array::BeUnique

Inherits:
Object
  • Object
show all
Defined in:
lib/ergomentum_rspec/matchers/array/be_unique.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



24
25
26
# File 'lib/ergomentum_rspec/matchers/array/be_unique.rb', line 24

def description
  "be unique"
end

#failure_messageObject



16
17
18
# File 'lib/ergomentum_rspec/matchers/array/be_unique.rb', line 16

def failure_message
  "expected array #{@actual.inspect} to be unique"
end

#failure_message_when_negatedObject



20
21
22
# File 'lib/ergomentum_rspec/matchers/array/be_unique.rb', line 20

def failure_message_when_negated
  "expected array #{@actual.inspect} to be not unique"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/ergomentum_rspec/matchers/array/be_unique.rb', line 11

def matches?(actual)
  @actual = actual
  actual.find { |e| actual.count(e) == 1 }
end