Class: CarrierWave::Test::Matchers::HaveHeight

Inherits:
Object
  • Object
show all
Defined in:
lib/carrierwave/test/matchers.rb

Overview

:nodoc:

Instance Method Summary (collapse)

Constructor Details

- (HaveHeight) initialize(height)



158
159
160
# File 'lib/carrierwave/test/matchers.rb', line 158

def initialize(height)
  @height = height
end

Instance Method Details

- (Object) description



178
179
180
# File 'lib/carrierwave/test/matchers.rb', line 178

def description
  "have an exact height of #{@height}"
end

- (Object) failure_message



170
171
172
# File 'lib/carrierwave/test/matchers.rb', line 170

def failure_message
  "expected #{@actual.current_path.inspect} to have an exact size of #{@height}, but it was #{@actual_height}."
end

- (Boolean) matches?(actual)



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

- (Object) negative_failure_message



174
175
176
# File 'lib/carrierwave/test/matchers.rb', line 174

def negative_failure_message
  "expected #{@actual.current_path.inspect} not to have an exact size of #{@height}, but it did."
end