Skip to content

Commit

Permalink
Merge pull request #1146 from dradis/fix_board_factory
Browse files Browse the repository at this point in the history
Fix Boards Factory - associate with the right project
  • Loading branch information
etdsoft committed May 9, 2023
2 parents d88f80e + ce02e85 commit b18cbc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions spec/factories/boards.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
FactoryBot.define do
factory :board do
sequence(:name){ |n| "Board-#{n}" }
node { create(:project).methodology_library }

sequence(:name) { |n| "Board-#{n}" }
association :project

after(:build) do |board|
board.node = board.project.methodology_library unless board.node.present?
end
end
end
4 changes: 2 additions & 2 deletions spec/models/card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe Card do
it { should belong_to(:list).touch(true) }
it { should have_and_belong_to_many(:assignees).class_name("User") }
it { should have_and_belong_to_many(:assignees).class_name('User') }
it { should have_many(:comments).dependent(:destroy) }

it { should validate_length_of(:description).is_at_most(DB_MAX_TEXT_LENGTH) }
Expand All @@ -20,7 +20,7 @@

describe 'on create' do
it 'subscribes new assignees' do
new_card = build(:card, assignee_ids: create_list(:user, 2).map(&:id))
new_card = build(:card, assignee_ids: create_list(:user, 2).map(&:id), list: @parent)
expect { new_card.save }.to change {
Subscription.count
}.by(2)
Expand Down

0 comments on commit b18cbc9

Please sign in to comment.