Class: CarrierWave::Test::Matchers::BeNoTallerThan
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::BeNoTallerThan
- Defined in:
- lib/carrierwave/test/matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(height) ⇒ BeNoTallerThan
constructor
A new instance of BeNoTallerThan.
- #matches?(actual) ⇒ Boolean
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
#description ⇒ Object
290 291 292 |
# File 'lib/carrierwave/test/matchers.rb', line 290 def description "have a height less than or equal to #{@height}" end |
#failure_message ⇒ Object
282 283 284 |
# File 'lib/carrierwave/test/matchers.rb', line 282 def "expected #{@actual.current_path.inspect} to be no taller than #{@height}, but it was #{@actual_height}." end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
286 287 288 |
# File 'lib/carrierwave/test/matchers.rb', line 286 def "expected #{@actual.current_path.inspect} not to be taller than #{@height}, but it is." end |
#matches?(actual) ⇒ 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 |