Class: CarrierWave::Test::Matchers::BeNoTallerThan

Inherits:
Object
  • Object
show all
Defined in:
lib/carrierwave/test/matchers.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(height) ⇒ BeNoTallerThan

Returns a new instance of BeNoTallerThan.



270
271
272
# File 'lib/carrierwave/test/matchers.rb', line 270

def initialize(height)
  @height = height
end

Instance Method Details

#descriptionObject



290
291
292
# File 'lib/carrierwave/test/matchers.rb', line 290

def description
  "have a height less than or equal to #{@height}"
end

#failure_messageObject



282
283
284
# File 'lib/carrierwave/test/matchers.rb', line 282

def failure_message
  "expected #{@actual.current_path.inspect} to be no taller than #{@height}, but it was #{@actual_height}."
end

#failure_message_when_negatedObject Also known as: negative_failure_message



286
287
288
# File 'lib/carrierwave/test/matchers.rb', line 286

def failure_message_when_negated
  "expected #{@actual.current_path.inspect} not to be taller than #{@height}, but it is."
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


274
275
276
277
278
279
280
# File 'lib/carrierwave/test/matchers.rb', line 274

def matches?(actual)
  @actual = actual
  # Satisfy expectation here. Return false or raise an error if it's not met.
  image = ImageLoader.load_image(@actual.current_path)
  @actual_height = image.height
  @actual_height <= @height
end