Skip to content

Commit

Permalink
Add Switch#ext_management_system
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Aug 3, 2023
1 parent 1a00c40 commit 9a8005f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/switch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class Switch < ApplicationRecord
include CustomActionsMixin

belongs_to :host, :inverse_of => :host_virtual_switches
has_one :ext_management_system, :through => :host

has_many :host_switches, :dependent => :destroy
has_many :hosts, :through => :host_switches
Expand Down
9 changes: 9 additions & 0 deletions spec/models/switch_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
RSpec.describe Switch do
let(:ems) { FactoryBot.create(:ext_management_system) }
let(:host) { FactoryBot.create(:host, :ext_management_system => ems) }
let(:switch) { FactoryBot.create(:switch, :host => host) }

it "#ext_management_system" do
expect(switch.ext_management_system).to eq(ems)
end
end

0 comments on commit 9a8005f

Please sign in to comment.