blob: a939372ef034fe51fce09063ddeea4c6d2c0d0e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
require "spec_helper"
describe License do
describe ".most_recent" do
let!(:oldest_license) { License.create }
let!(:newest_license) { License.create }
it "returns the most recently created well licenses" do
results = License.most_recent(page: 1, per_page: 2)
results.first.should == newest_license
results.last.should == oldest_license
end
it "returns the first page of results" do
results = License.most_recent(page: 1, per_page: 1)
results.count.should == 1
results.first.should == newest_license
end
it "returns the next page of results" do
results = License.most_recent(page: 2, per_page: 1)
results.count.should == 1
results.first.should == oldest_license
end
it "returns the first page of results when the page is below 1" do
results = License.most_recent(page: -1, per_page: 1)
results.count.should == 1
results.first.should == newest_license
end
end
end
|