checking actual values in the spec, not just counts

This commit is contained in:
Jason W. May 2014-11-25 09:12:24 -08:00
parent adb570fe53
commit 610c2a4d65

View File

@ -70,16 +70,17 @@ describe GroupsController do
it "ensures that membership can be paginated" do
5.times { group.add(Fabricate(:user)) }
usernames = group.users.map{ |m| m['username'] }.sort
xhr :get, :members, group_id: group.name, limit: 3
response.should be_success
members = JSON.parse(response.body)
members.count.should eq(3)
members.map{ |m| m['username'] }.should eq(usernames[0..2])
xhr :get, :members, group_id: group.name, limit: 250, offset: 250
xhr :get, :members, group_id: group.name, limit: 3, offset: 3
response.should be_success
members = JSON.parse(response.body)
members.count.should eq(2)
members.map{ |m| m['username'] }.should eq(usernames[3..4])
end
end
end