Class: CarrierWave::Test::Matchers::HaveWidth

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

Overview

:nodoc:

Instance Method Summary (collapse)

Constructor Details

- (HaveWidth) initialize(width)



206
207
208
# File 'lib/carrierwave/test/matchers.rb', line 206

def initialize(width)
  @width = width
end

Instance Method Details

- (Object) description



226
227
228
# File 'lib/carrierwave/test/matchers.rb', line 226

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

- (Object) failure_message



218
219
220
# File 'lib/carrierwave/test/matchers.rb', line 218

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

- (Object) failure_message_when_negated Also known as: negative_failure_message



222
223
224
# File 'lib/carrierwave/test/matchers.rb', line 222

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

- (Boolean) matches?(actual)



210
211
212
213
214
215
216
# File 'lib/carrierwave/test/matchers.rb', line 210

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