Sha256: f7f467f692b922e3a4611aabe8080b4008370c6ab33f3103e0aa6cc265c04dd9

Contents?: true

Size: 769 Bytes

Versions: 4

Compression:

Stored size: 769 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
    specify 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
    specify 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.1.1 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb
normalizy-1.1.0 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb
normalizy-1.0.1 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb
normalizy-1.0.0 spec/normalizy/rspec/matcher/failure_message_when_negated_spec.rb