Class: CarrierWave::Test::Matchers::BeNoWiderThan
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::BeNoWiderThan
- 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) ⇒ BeNoWiderThan
constructor
A new instance of BeNoWiderThan.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(width) ⇒ BeNoWiderThan
Returns a new instance of BeNoWiderThan.
237 238 239 |
# File 'lib/carrierwave/test/matchers.rb', line 237 def initialize(width) @width = width end |
Instance Method Details
#description ⇒ Object
257 258 259 |
# File 'lib/carrierwave/test/matchers.rb', line 257 def description "have a width less than or equal to #{@width}" end |
#failure_message ⇒ Object
249 250 251 |
# File 'lib/carrierwave/test/matchers.rb', line 249 def "expected #{@actual.current_path.inspect} to be no wider than #{@width}, but it was #{@actual_width}." end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
253 254 255 |
# File 'lib/carrierwave/test/matchers.rb', line 253 def "expected #{@actual.current_path.inspect} not to be wider than #{@width}, but it is." end |
#matches?(actual) ⇒ Boolean
241 242 243 244 245 246 247 |
# File 'lib/carrierwave/test/matchers.rb', line 241 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 |