Sha256: 609047fe30cc0bfc47a5bcd9c11501bd44dc428279164c1f4173dbb4f2421bf0
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe Attachy::File, '#default' do context 'when config is missing' do before do allow(::Rails).to receive_message_chain(:application, :config_for) { nil } end specify { expect(described_class.default).to eq nil } end context 'when default image is present' do before do allow(::Rails).to receive_message_chain(:application, :config_for).with(:attachy) do { 'default' => { 'image' => { 'public_id' => 'default', 'format' => 'png', 'version' => 1 } } } end end it 'returns a new file object with the config values' do default = described_class.default expect(default).to be_new_record expect(default.format).to eq 'png' expect(default.public_id).to eq 'default' expect(default.version).to eq '1' end end context 'when default image is not present' do before do allow(::Rails).to receive_message_chain(:application, :config_for).with(:attachy) do { 'default' => {} } end end specify { expect(described_class.default).to eq nil } end context 'when default image is not present' do before do allow(::Rails).to receive_message_chain(:application, :config_for).with(:attachy) { {} } end specify { expect(described_class.default).to eq nil } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
attachy-0.4.1 | spec/models/attachy/file/default_spec.rb |