Class: ActiveStorageMatchers::BeBlobUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/dev/test/rspec_support/activestorage_matchers.rb

Instance Method Summary collapse

Constructor Details

#initialize(expected) ⇒ BeBlobUrl

Returns a new instance of BeBlobUrl.



87
88
89
# File 'lib/decidim/dev/test/rspec_support/activestorage_matchers.rb', line 87

def initialize(expected)
  @expected = expected
end

Instance Method Details

#descriptionObject



91
92
93
# File 'lib/decidim/dev/test/rspec_support/activestorage_matchers.rb', line 91

def description
  "be a blob URL"
end

#failure_messageObject



101
102
103
# File 'lib/decidim/dev/test/rspec_support/activestorage_matchers.rb', line 101

def failure_message
  "expected #{actual} to match blob with ID #{expected.id}"
end

#failure_message_when_negatedObject



105
106
107
# File 'lib/decidim/dev/test/rspec_support/activestorage_matchers.rb', line 105

def failure_message_when_negated
  "expected #{actual} not to match blob with ID #{expected.id}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


95
96
97
98
99
# File 'lib/decidim/dev/test/rspec_support/activestorage_matchers.rb', line 95

def matches?(actual)
  @actual = actual
  match = BlobMatch.new(actual)
  match.blob == expected
end