Class: CarrierWave::Test::Matchers::BeNoLargerThan
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::BeNoLargerThan
- 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(width, height) ⇒ BeNoLargerThan
constructor
A new instance of BeNoLargerThan.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(width, height) ⇒ BeNoLargerThan
Returns a new instance of BeNoLargerThan.
103 104 105 |
# File 'lib/carrierwave/test/matchers.rb', line 103 def initialize(width, height) @width, @height = width, height end |
Instance Method Details
#description ⇒ Object
124 125 126 |
# File 'lib/carrierwave/test/matchers.rb', line 124 def description "be no larger than #{@width} by #{@height}" end |
#failure_message ⇒ Object
116 117 118 |
# File 'lib/carrierwave/test/matchers.rb', line 116 def "expected #{@actual.current_path.inspect} to be no larger than #{@width} by #{@height}, but it was #{@actual_width} by #{@actual_height}." end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
120 121 122 |
# File 'lib/carrierwave/test/matchers.rb', line 120 def "expected #{@actual.current_path.inspect} to be larger than #{@width} by #{@height}, but it wasn't." end |
#matches?(actual) ⇒ Boolean
107 108 109 110 111 112 113 114 |
# File 'lib/carrierwave/test/matchers.rb', line 107 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_width = image.width @actual_height = image.height @actual_width <= @width && @actual_height <= @height end |