Make test for feed limit more explicit

The limit parameter wasn't specified in the test but in the default
value in the database, making the test hard to read.

Since now we've moved the other processes to separate tests, now we can
create four processes using `times` and keep the test simple.
This commit is contained in:
Javi Martín
2019-09-28 14:17:24 +02:00
parent d410fcbc0e
commit d09be11a08

View File

@@ -57,15 +57,12 @@ describe Widget::Feed do
end
describe "#processes" do
let(:feed) { build(:widget_feed, kind: "processes") }
let(:feed) { build(:widget_feed, kind: "processes", limit: 3) }
it "returns open and published processes" do
open_process1 = create(:legislation_process, :open, :published, title: "Open process 1")
open_process2 = create(:legislation_process, :open, :published, title: "Open process 2")
open_process3 = create(:legislation_process, :open, :published, title: "Open process 3")
open_process4 = create(:legislation_process, :open, :published, title: "Open process 4")
it "returns a maximum number of open published processes given by the limit" do
4.times { create(:legislation_process, :open, :published) }
expect(feed.processes).to eq([open_process4, open_process3, open_process2])
expect(feed.processes.count).to be 3
end
it "does not return past processes" do