Create nested group factory

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2016-12-07 19:16:17 +02:00
parent b552a4eb18
commit d7010fdcd7
2 changed files with 11 additions and 0 deletions

View file

@ -19,5 +19,9 @@ FactoryGirl.define do
trait :access_requestable do trait :access_requestable do
request_access_enabled true request_access_enabled true
end end
trait :nested do
parent factory: :group
end
end end
end end

View file

@ -271,4 +271,11 @@ describe Group, models: true do
expect(group.web_url).to include("groups/#{group.name}") expect(group.web_url).to include("groups/#{group.name}")
end end
end end
describe 'nested group' do
subject { create(:group, :nested) }
it { is_expected.to be_valid }
it { expect(subject.parent).to be_kind_of(Group) }
end
end end