mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-04 22:16:08 +00:00
Find enterprise groups on the front page
This commit is contained in:
@@ -2,4 +2,6 @@ class EnterpriseGroup < ActiveRecord::Base
|
||||
has_and_belongs_to_many :enterprises
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
scope :on_front_page, where(on_front_page: true)
|
||||
end
|
||||
|
||||
@@ -28,4 +28,13 @@ describe EnterpriseGroup do
|
||||
# eg.reload.image.should == image
|
||||
# end
|
||||
end
|
||||
|
||||
describe "scopes" do
|
||||
it "finds enterprise groups on the front page" do
|
||||
eg1 = create(:enterprise_group, on_front_page: true)
|
||||
eg2 = create(:enterprise_group, on_front_page: false)
|
||||
|
||||
EnterpriseGroup.on_front_page.should == [eg1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user