Rspec Check Array Without Order

[Solved] Rspec Check Array Without Order | Ruby - Code Explorer | yomemimo.com
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

Answers related to rspec check array without order

Code Explorer Popular Question For Ruby