mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-17 14:46:00 +08:00
857bda6f69
- Models tests - Controllers tests - Jobs tests - Permissions tests - Utilities tests
26 lines
697 B
Ruby
26 lines
697 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe Connection, type: :model do
|
|
let(:connection) { build :connection }
|
|
|
|
it 'is valid' do
|
|
expect(connection).to be_valid
|
|
end
|
|
|
|
it 'should be of class Connection' do
|
|
expect(subject.class).to eq Connection
|
|
end
|
|
|
|
describe 'Database table' do
|
|
it { should have_db_column :id }
|
|
it { should have_db_column :input_id }
|
|
it { should have_db_column :output_id }
|
|
end
|
|
|
|
describe 'Relations' do
|
|
it { should belong_to(:to).class_name('MyModule').with_foreign_key('input_id').inverse_of(:inputs) }
|
|
it { should belong_to(:from).class_name('MyModule').with_foreign_key('output_id').inverse_of(:outputs) }
|
|
end
|
|
end
|