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.
160 161 162 |
# File 'lib/carrierwave/test/matchers.rb', line 160 def initialize(height) @height = height end |
Instance Method Details
#description ⇒ Object
180 181 182 |
# File 'lib/carrierwave/test/matchers.rb', line 180 def description "have a height less than or equal to #{@height}" end |
#failure_message ⇒ Object
172 173 174 |
# File 'lib/carrierwave/test/matchers.rb', line 172 def "expected #{@actual.current_path.inspect} to be no taller than #{@height}, but it was #{@actual_height}." end |
#matches?(actual) ⇒ Boolean
164 165 166 167 168 169 170 |
# File 'lib/carrierwave/test/matchers.rb', line 164 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
176 177 178 |
# File 'lib/carrierwave/test/matchers.rb', line 176 def "expected #{@actual.current_path.inspect} not to be taller than #{@height}, but it is." end |