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
-
#initialize(width) ⇒ BeNoWiderThan
constructor
A new instance of BeNoWiderThan.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(width) ⇒ BeNoWiderThan
Returns a new instance of BeNoWiderThan.
130 131 132 |
# File 'lib/carrierwave/test/matchers.rb', line 130 def initialize(width) @width = width end |
Instance Method Details
#description ⇒ Object
150 151 152 |
# File 'lib/carrierwave/test/matchers.rb', line 150 def description "have a width less than or equal to #{@width}" end |
#failure_message ⇒ Object
142 143 144 |
# File 'lib/carrierwave/test/matchers.rb', line 142 def "expected #{@actual.current_path.inspect} to be no wider than #{@width}, but it was #{@actual_width}." end |
#matches?(actual) ⇒ Boolean
134 135 136 137 138 139 140 |
# File 'lib/carrierwave/test/matchers.rb', line 134 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 |
#negative_failure_message ⇒ Object
146 147 148 |
# File 'lib/carrierwave/test/matchers.rb', line 146 def "expected #{@actual.current_path.inspect} not to be wider than #{@width}, but it is." end |