Sha256: aef7e3de0581f3b28dc25c2114470d5a631e61f7fac7f63e88df5fb2310b9152

Contents?: true

Size: 634 Bytes

Versions: 1

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

RSpec.describe Article, '#findy!' do
  context 'when a hash is given' do
    context 'when record is found' do
      let!(:record) { described_class.create id: 1 }
      let!(:hash)   { 'My' }

      it 'finds the record' do
        expect(described_class.findy!(hash)).to eq record
      end
    end

    context 'when record is not found' do
      let!(:hash) { 'My' }

      it 'raises' do
        message = %(Couldn't find User with 'idy'="My")

        expect { described_class.findy!(hash) }.to raise_error ActiveRecord::RecordNotFound, message
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
idy-1.1.0 spec/lib/idy/extension/findy_bump_spec.rb