2016-09-24 03:00:46 +00:00
|
|
|
# frozen_string_literal: true
|
2017-11-25 19:23:47 +00:00
|
|
|
|
2015-10-12 03:37:44 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2015-12-16 14:19:58 +00:00
|
|
|
RSpec.describe Topic, type: :model do
|
2015-12-17 15:45:38 +00:00
|
|
|
it { is_expected.to belong_to :user }
|
|
|
|
it { is_expected.to belong_to :metacode }
|
|
|
|
it { is_expected.to have_many :maps }
|
2015-12-18 01:26:07 +00:00
|
|
|
it { is_expected.to have_many :mappings }
|
|
|
|
it { is_expected.to validate_presence_of :permission }
|
|
|
|
it { is_expected.to validate_inclusion_of(:permission).in_array Perm::ISSIONS.map(&:to_s) }
|
2018-02-06 06:05:41 +00:00
|
|
|
|
|
|
|
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
|
2015-10-12 03:37:44 +00:00
|
|
|
end
|