start topic spec
This commit is contained in:
parent
f10af09164
commit
2d04cca125
1 changed files with 16 additions and 0 deletions
|
@ -9,4 +9,20 @@ RSpec.describe Topic, type: :model do
|
||||||
it { is_expected.to have_many :mappings }
|
it { is_expected.to have_many :mappings }
|
||||||
it { is_expected.to validate_presence_of :permission }
|
it { is_expected.to validate_presence_of :permission }
|
||||||
it { is_expected.to validate_inclusion_of(:permission).in_array Perm::ISSIONS.map(&:to_s) }
|
it { is_expected.to validate_inclusion_of(:permission).in_array Perm::ISSIONS.map(&:to_s) }
|
||||||
|
|
||||||
|
describe 'attachments_json' do
|
||||||
|
let (:attachments) do
|
||||||
|
create_list(:attachment, 1,
|
||||||
|
file_file_name: 'file_name',
|
||||||
|
file_content_type: 'text/plain',
|
||||||
|
file_file_size: '100')
|
||||||
|
end
|
||||||
|
let (:topic) { create(:topic, attachments: attachments) }
|
||||||
|
let(:json) { topic.attachments_json }
|
||||||
|
|
||||||
|
it 'returns correct json' do
|
||||||
|
expect(json.first[:id]).to equal(attachments.first.id)
|
||||||
|
binding.pry
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue