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
-
#initialize(height) ⇒ BeNoTallerThan
constructor
A new instance of BeNoTallerThan.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(height) ⇒ BeNoTallerThan
Returns a new instance of BeNoTallerThan.
248 249 250 |
# File 'lib/carrierwave/test/matchers.rb', line 248 def initialize(height) @height = height end |
Instance Method Details
#description ⇒ Object
268 269 270 |
# File 'lib/carrierwave/test/matchers.rb', line 268 def description "have a height less than or equal to #{@height}" end |
#failure_message ⇒ Object
260 261 262 |
# File 'lib/carrierwave/test/matchers.rb', line 260 def "expected #{@actual.current_path.inspect} to be no taller than #{@height}, but it was #{@actual_height}." end |
#matches?(actual) ⇒ Boolean
252 253 254 255 256 257 258 |
# File 'lib/carrierwave/test/matchers.rb', line 252 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 |
#negative_failure_message ⇒ Object
264 265 266 |
# File 'lib/carrierwave/test/matchers.rb', line 264 def "expected #{@actual.current_path.inspect} not to be taller than #{@height}, but it is." end |