Simplify testing array contents

We were testing for the size and the content of the elements when we
could test for the array itself.
This commit is contained in:
Javi Martín
2019-09-24 21:01:32 +02:00
parent 4301937e85
commit f27beb1e47
17 changed files with 59 additions and 140 deletions

View File

@@ -435,16 +435,16 @@ describe User do
user1 = create(:user, email: "larry@consul.dev")
create(:user, email: "bird@consul.dev")
search = User.search("larry@consul.dev")
expect(search.size).to eq(1)
expect(search.first).to eq(user1)
expect(search).to eq [user1]
end
it "find users by name" do
user1 = create(:user, username: "Larry Bird")
create(:user, username: "Robert Parish")
search = User.search("larry")
expect(search.size).to eq(1)
expect(search.first).to eq(user1)
expect(search).to eq [user1]
end
it "returns no results if no search term provided" do