Class: CarrierWave::Test::Matchers::HaveHeight
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::HaveHeight
- Defined in:
- lib/carrierwave/test/matchers.rb
Overview
:nodoc:
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
-
#initialize(height) ⇒ HaveHeight
constructor
A new instance of HaveHeight.
- #matches?(actual) ⇒ Boolean
- #negative_failure_message ⇒ Object
Constructor Details
#initialize(height) ⇒ HaveHeight
Returns a new instance of HaveHeight.
158 159 160 |
# File 'lib/carrierwave/test/matchers.rb', line 158 def initialize(height) @height = height end |
Instance Method Details
#description ⇒ Object
178 179 180 |
# File 'lib/carrierwave/test/matchers.rb', line 178 def description "have an exact height of #{@height}" end |
#failure_message ⇒ Object
170 171 172 |
# File 'lib/carrierwave/test/matchers.rb', line 170 def "expected #{@actual.current_path.inspect} to have an exact size of #{@height}, but it was #{@actual_height}." end |
#matches?(actual) ⇒ Boolean
162 163 164 165 166 167 168 |
# File 'lib/carrierwave/test/matchers.rb', line 162 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
174 175 176 |
# File 'lib/carrierwave/test/matchers.rb', line 174 def "expected #{@actual.current_path.inspect} not to have an exact size of #{@height}, but it did." end |