Class: CarrierWave::Test::Matchers::HaveWidth
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::HaveWidth
- 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) ⇒ HaveWidth
constructor
A new instance of HaveWidth.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(width) ⇒ HaveWidth
Returns a new instance of HaveWidth.
204 205 206 |
# File 'lib/carrierwave/test/matchers.rb', line 204 def initialize(width) @width = width end |
Instance Method Details
#description ⇒ Object
224 225 226 |
# File 'lib/carrierwave/test/matchers.rb', line 224 def description "have an exact width of #{@width}" end |
#failure_message ⇒ Object
216 217 218 |
# File 'lib/carrierwave/test/matchers.rb', line 216 def "expected #{@actual.current_path.inspect} to have an exact size of #{@width}, but it was #{@actual_width}." end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
220 221 222 |
# File 'lib/carrierwave/test/matchers.rb', line 220 def "expected #{@actual.current_path.inspect} not to have an exact size of #{@width}, but it did." end |
#matches?(actual) ⇒ Boolean
208 209 210 211 212 213 214 |
# File 'lib/carrierwave/test/matchers.rb', line 208 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_width == @width end |