Skip to content

Commit

Permalink
Fix the issue where the kit should be excluded when the organization …
Browse files Browse the repository at this point in the history
…is created. (#4887)
  • Loading branch information
nozomirin committed Dec 29, 2024
1 parent 220af87 commit f058d41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/organization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def total_inventory
end

def self.seed_items(organization = Organization.all)
base_items = BaseItem.all.map(&:to_h)
base_items = BaseItem.without_kit.map(&:to_h)

Array.wrap(organization).each do |org|
Rails.logger.info "\n\nSeeding #{org.name}'s items...\n"
Expand Down
8 changes: 8 additions & 0 deletions spec/models/organization_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@

expect(organization.items.count).to eq(1)
end

it "should exclude kit" do
create(:base_item, name: "Kit", partner_key: "foo")

Organization.seed_items(organization)

expect(organization.items.count).to eq(0)
end
end

context "when no organization is provided" do
Expand Down

0 comments on commit f058d41

Please sign in to comment.