Sha256: 82fc8790470116abbf27fd9a02f4cb2a1aaa29d9c548e3da0a93fcc3b49dd491

Contents?: true

Size: 572 Bytes

Versions: 1

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

require 'rails_helper'

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

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

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

      it 'raises' do
        expect { Article.findy!(hash) }.to raise_error ActiveRecord::RecordNotFound, %(Couldn't find User with 'idy'="My")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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