Skip to content

Instantly share code, notes, and snippets.

@SophiaPetrova
Last active April 12, 2023 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SophiaPetrova/80906f4707de6188302e to your computer and use it in GitHub Desktop.
Save SophiaPetrova/80906f4707de6188302e to your computer and use it in GitHub Desktop.
describe 'remove_duplicates' do
it 'removes duplicates' do
expect(remove_duplicates [-2, 12, 33, -2, 42, -2, 4, 8, 4, 13, 12]).
to eq [-2, 12, 33, 42, 4, 8, 13]
expect(remove_duplicates [-1, 4, -1, 33, 33, 42, 4]).
to eq [-1, 4, 33, 42]
expect(remove_duplicates [0, 7, 8, 7, 8, 78, 0, 2, 4, 6]).
to eq [0, 7, 8, 78, 2, 4, 6]
end
it 'returns empty array' do
expect(remove_duplicates []).
to eq []
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment