Commit b552a4eb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Validate presence of route by Routable concern

Signed-off-by: default avatarDmitriy Zaporozhets <>
parent a9f921bdc22d
......@@ -7,6 +7,7 @@ module Routable
has_one :route, as: :source, autosave: true, dependent: :destroy
validates_associated :route
validates :route, presence: true
before_validation :update_route_path, if: :full_path_changed?
......@@ -3,6 +3,10 @@
describe Group, 'Routable' do
let!(:group) { create(:group) }
describe 'Validations' do
it { validate_presence_of(:route) }
describe 'Associations' do
it { have_one(:route).dependent(:destroy) }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment