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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user