Remove unused (and flaky) card code and its spec

This code was introduced in commit 722a431b, but it stopped being used
in commit 7657a0e0.

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:
Javi Martín
2019-05-10 14:24:56 +02:00
parent a1d6885132
commit 574bd87b08
2 changed files with 0 additions and 20 deletions

View File

@@ -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

View File

@@ -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