Class: CarrierWave::Test::Matchers::BeFormat
- Inherits:
-
Object
- Object
- CarrierWave::Test::Matchers::BeFormat
- 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(expected) ⇒ BeFormat
constructor
A new instance of BeFormat.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ BeFormat
Returns a new instance of BeFormat.
303 304 305 |
# File 'lib/carrierwave/test/matchers.rb', line 303 def initialize(expected) @expected = expected end |
Instance Method Details
#description ⇒ Object
323 324 325 |
# File 'lib/carrierwave/test/matchers.rb', line 323 def description "have #{@expected} format" end |
#failure_message ⇒ Object
315 316 317 |
# File 'lib/carrierwave/test/matchers.rb', line 315 def "expected #{@actual.current_path.inspect} to have #{@expected} format, but it was #{@actual_expected}." end |
#failure_message_when_negated ⇒ Object Also known as: negative_failure_message
319 320 321 |
# File 'lib/carrierwave/test/matchers.rb', line 319 def "expected #{@actual.current_path.inspect} not to have #{@expected} format, but it did." end |
#matches?(actual) ⇒ Boolean
307 308 309 310 311 312 313 |
# File 'lib/carrierwave/test/matchers.rb', line 307 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_expected = image.format !@expected.nil? && @actual_expected.casecmp(@expected).zero? end |