2016-04-02 18:10:28 +05:30
|
|
|
require 'rails_helper'
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
describe Appearance do
|
2016-11-03 12:29:30 +05:30
|
|
|
subject { build(:appearance) }
|
2016-04-02 18:10:28 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it { include(CacheableAttributes) }
|
|
|
|
it { expect(described_class.current_without_cache).to eq(described_class.first) }
|
2016-04-02 18:10:28 +05:30
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
it { is_expected.to have_many(:uploads) }
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
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-11-08 19:23:39 +05:30
|
|
|
|
|
|
|
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-04-02 18:10:28 +05:30
|
|
|
end
|