Commit a2f8f9ad authored by Yorick Peterse's avatar Yorick Peterse

Fixed User sorting specs

The descriptions were not accurate and one particular spec seemingly
expected the wrong User row to be returned.
parent 732f5380
...@@ -663,24 +663,24 @@ describe User do ...@@ -663,24 +663,24 @@ describe User do
@user1 = create :user, created_at: Date.today - 1, last_sign_in_at: Date.today - 1, name: 'Omega' @user1 = create :user, created_at: Date.today - 1, last_sign_in_at: Date.today - 1, name: 'Omega'
end end
it "sorts users as recently_signed_in" do it "sorts users by the recent sign-in time" do
expect(User.sort('recent_sign_in').first).to eq(@user) expect(User.sort('recent_sign_in').first).to eq(@user)
end end
it "sorts users as late_signed_in" do it "sorts users by the oldest sign-in time" do
expect(User.sort('oldest_sign_in').first).to eq(@user1) expect(User.sort('oldest_sign_in').first).to eq(@user1)
end end
it "sorts users as recently_created" do it "sorts users in descending order by their creation time" do
expect(User.sort('created_desc').first).to eq(@user) expect(User.sort('created_desc').first).to eq(@user)
end end
it "sorts users as late_created" do it "sorts users in ascending order by their creation time" do
expect(User.sort('created_asc').first).to eq(@user1) expect(User.sort('created_asc').first).to eq(@user1)
end end
it "sorts users by name when nil is passed" do it "sorts users by id in descending order when nil is passed" do
expect(User.sort(nil).first).to eq(@user) expect(User.sort(nil).first).to eq(@user1)
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment