2015-10-12 03:37:44 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2015-12-16 14:19:58 +00:00
|
|
|
RSpec.describe Synapse, type: :model do
|
2015-12-18 01:26:15 +00:00
|
|
|
it { is_expected.to belong_to :user }
|
|
|
|
it { is_expected.to belong_to :topic1 }
|
|
|
|
it { is_expected.to belong_to :topic2 }
|
|
|
|
it { is_expected.to have_many :maps }
|
|
|
|
it { is_expected.to have_many :mappings }
|
2015-12-18 01:28:20 +00:00
|
|
|
it { is_expected.to validate_presence_of :permission }
|
|
|
|
it { is_expected.to validate_inclusion_of(:permission).in_array Perm::ISSIONS.map(&:to_s) }
|
2016-02-09 06:25:39 +00:00
|
|
|
it { is_expected.to validate_inclusion_of(:category).in_array ['from-to', 'both'] }
|
2016-07-26 00:14:23 +00:00
|
|
|
it { is_expected.to validate_length_of(:desc).is_at_least(0) } # TODO: don't allow nil
|
2015-10-12 03:37:44 +00:00
|
|
|
end
|