Question : rspec check array without order
Answered by : akshay-kakade
expect([1, 2, 3]).to contain_exactly(2, 3, 1) # pass expect([:a, :c, :b]).to contain_exactly(:a, :c ) # fail
Source : https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers/contain-exactly-matcher | Last Update : Mon, 27 Sep 21
Question : rspec check array without order
Answered by : akshay-kakade
expect([1, 2, 3]).to match_array [2, 3, 1] # pass expect([:a, :c, :b]).to match_array [:a, :c] # fail
Source : https://relishapp.com/rspec/rspec-expectations/v/3-10/docs/built-in-matchers/contain-exactly-matcher | Last Update : Mon, 27 Sep 21