diff --git a/app/furniture/marketplace/marketplace.rb b/app/furniture/marketplace/marketplace.rb index 94e13e8fc..47b7bc401 100644 --- a/app/furniture/marketplace/marketplace.rb +++ b/app/furniture/marketplace/marketplace.rb @@ -3,6 +3,7 @@ class Marketplace class Marketplace < Furniture location(parent: :room) + default_scope { where(furniture_kind: "marketplace") } has_many :products, inverse_of: :marketplace, dependent: :destroy has_many :carts, inverse_of: :marketplace, dependent: :destroy diff --git a/spec/furniture/marketplace/marketplace_spec.rb b/spec/furniture/marketplace/marketplace_spec.rb index dec15a731..bef49f457 100644 --- a/spec/furniture/marketplace/marketplace_spec.rb +++ b/spec/furniture/marketplace/marketplace_spec.rb @@ -16,4 +16,14 @@ specify { expect { marketplace.destroy }.not_to change(orders, :count) } end end + + describe ".all" do + subject(:all) { described_class.all } + + let!(:non_marketplace_furniture) { create(:journal) } + let!(:marketplace_furniture) { create(:marketplace) } + + it { is_expected.not_to include(non_marketplace_furniture) } + it { is_expected.to include(marketplace_furniture) } + end end