Class: UrlKeyedObject::RSpec::Matchers::UrlKeyedObjectMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/url_keyed_object/rspec/matchers.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



14
15
16
# File 'lib/url_keyed_object/rspec/matchers.rb', line 14

def description
  "have declared has_url_key"
end

#failure_messageObject



18
19
20
# File 'lib/url_keyed_object/rspec/matchers.rb', line 18

def failure_message
  "expected #{@subject.class.name} to have declared has_url_key"
end

#matches?(subject) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/url_keyed_object/rspec/matchers.rb', line 9

def matches?(subject)
  @subject = subject
  @subject.class.respond_to?(:url_key_helper) && @subject.respond_to?(:generate_valid_url_key)
end

#negative_failure_messageObject



22
23
24
# File 'lib/url_keyed_object/rspec/matchers.rb', line 22

def negative_failure_message
  "expected #{@subject.class.name} to have NOT declared has_url_key"
end