2016-02-22 14:49:16 -05:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2017-09-05 03:37:06 -04:00
|
|
|
describe Appearance do
|
2016-10-12 01:50:01 -04:00
|
|
|
subject { build(:appearance) }
|
2016-02-22 14:49:16 -05:00
|
|
|
|
2018-05-04 13:23:50 -04:00
|
|
|
it { include(CacheableAttributes) }
|
|
|
|
it { expect(described_class.current_without_cache).to eq(described_class.first) }
|
2016-02-22 14:49:16 -05:00
|
|
|
|
2018-05-02 12:21:42 -04:00
|
|
|
it { is_expected.to have_many(:uploads) }
|
2017-08-09 10:41:51 -04:00
|
|
|
|
|
|
|
describe '#single_appearance_row' do
|
|
|
|
it 'adds an error when more than 1 row exists' do
|
|
|
|
create(:appearance)
|
|
|
|
|
|
|
|
new_row = build(:appearance)
|
|
|
|
new_row.save
|
|
|
|
|
|
|
|
expect(new_row.valid?).to eq(false)
|
|
|
|
end
|
|
|
|
end
|
2018-05-02 12:21:42 -04:00
|
|
|
|
|
|
|
context 'with uploads' do
|
|
|
|
it_behaves_like 'model with mounted uploader', false do
|
|
|
|
let(:model_object) { create(:appearance, :with_logo) }
|
|
|
|
let(:upload_attribute) { :logo }
|
|
|
|
let(:uploader_class) { AttachmentUploader }
|
|
|
|
end
|
|
|
|
end
|
2016-02-22 14:49:16 -05:00
|
|
|
end
|