Remove unused (and flaky) card code and its spec
This code was introduced in commit722a431b, but it stopped being used in commit7657a0e0. The spec was failing sometimes because the method didn't order the records, but the spec checked the records returned in a certain order. Furthermore, the method `page` generated a potential conflict with kaminari's `page method.
This commit is contained in:
@@ -18,10 +18,4 @@ class Widget::Card < ApplicationRecord
|
||||
def self.body
|
||||
where(header: false, site_customization_page_id: nil).order(:created_at)
|
||||
end
|
||||
|
||||
#add widget cards to custom pages
|
||||
def self.page(page_id)
|
||||
where(site_customization_page_id: page_id)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -36,18 +36,4 @@ describe Widget::Card do
|
||||
expect(Widget::Card.body).not_to include(page_card)
|
||||
end
|
||||
end
|
||||
|
||||
describe "#custom page" do
|
||||
|
||||
it "return cards for the custom pages" do
|
||||
header = create(:widget_card, header: true)
|
||||
card = create(:widget_card, header: false)
|
||||
card1 = create(:widget_card, header: false, title: "Card 1", site_customization_page_id: 1)
|
||||
card2 = create(:widget_card, header: false, title: "Card 2", site_customization_page_id: 1)
|
||||
card3 = create(:widget_card, header: false, title: "Card 3", site_customization_page_id: 1)
|
||||
|
||||
expect(Widget::Card.page(1)).to eq([card1, card2, card3])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user