diff --git a/app/models/organization.rb b/app/models/organization.rb index 5b61b3b6e2..97fd8c6694 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -225,9 +225,9 @@ def seed_items(item_collection) def seed_random_item_with_name(name) base_items = BaseItem.all.map(&:to_h) - base_item = Array.wrap(base_items).sample() + base_item = Array.wrap(base_items).sample base_item[:name] = name - self.seed_items( base_item ) + seed_items(base_item) end def valid_items diff --git a/spec/models/organization_spec.rb b/spec/models/organization_spec.rb index 23e6361142..c4537d6ad5 100644 --- a/spec/models/organization_spec.rb +++ b/spec/models/organization_spec.rb @@ -304,11 +304,11 @@ describe "#seed_random_item_with_name" do it "adds an item with the given name" do - base_item = create(:base_item, name: "Foo", partner_key: "foo").to_h + create(:base_item, name: "Foo", partner_key: "foo").to_h expect do - expect( organization.items.find_by(name: "NotFoo", partner_key: "foo") ).to be_nil - organization.seed_random_item_with_name( "NotFoo" ) - expect( organization.items.find_by(name: "NotFoo", partner_key: "foo") ).to_not be_nil + expect(organization.items.find_by(name: "NotFoo", partner_key: "foo")).to be_nil + organization.seed_random_item_with_name("NotFoo") + expect(organization.items.find_by(name: "NotFoo", partner_key: "foo")).to_not be_nil end.to change { organization.items.size }.by(1) end end