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
- #failure_message_when_negated ⇒ Object (also: #negative_failure_message)
-
#initialize(height) ⇒ HaveHeight
constructor
A new instance of HaveHeight.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(height) ⇒ HaveHeight
Returns a new instance of HaveHeight.
171 172 173 |
# File 'lib/carrierwave/test/matchers.rb', line 171 def initialize(height) @height = height end |
Instance Method Details
#description ⇒ Object
191 192 193 |
# File 'lib/carrierwave/test/matchers.rb', line 191 def description "have an exact height of #{@height}" end |
#failure_message ⇒ Object
183 184 185 |
# File 'lib/carrierwave/test/matchers.rb', line 183 def "expected #{@actual.current_path.inspect} to have an exact size of #{@height}, but it was #{@actual_height}." end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
187 188 189 |
# File 'lib/carrierwave/test/matchers.rb', line 187 def "expected #{@actual.current_path.inspect} not to have an exact size of #{@height}, but it did." end |
#matches?(actual) ⇒ Boolean
175 176 177 178 179 180 181 |
# File 'lib/carrierwave/test/matchers.rb', line 175 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 |