Sha256: 67cef077c08f95db1d1a70aca8de2174f5d0e3ae1a28c137d65a1af5833c523c

Contents?: true

Size: 759 Bytes

Versions: 4

Compression:

Stored size: 759 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Normalizy::RSpec::Matcher, '.failure_message_when_negated' do
  let!(:model) { Match }

  context 'with no :with expectation' do
    it do
      matcher = described_class.new(:downcase_field)

      matcher.from 'from'
      matcher.to   'from'
      matcher.matches? model.new

      expect(matcher.failure_message_when_negated).to eq %(expected: value != "from"\n     got: "from")
    end
  end

  context 'with :with expectation' do
    it do
      matcher = described_class.new(:downcase_field)

      matcher.with :downcase
      matcher.matches? model.new

      expect(matcher.failure_message_when_negated).to eq %(expected: value != downcase\n     got: downcase)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
normalizy-1.5.0 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb
normalizy-1.4.0 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb
normalizy-1.3.0 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb
normalizy-1.2.0 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb