-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharray_sort_spec.rb
41 lines (31 loc) · 1.07 KB
/
array_sort_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
require './array_sort'
describe ArraySort do
subject { described_class.new(array_1, array_2) }
context 'given 2 sorted arrays' do
context 'given: [1,2,3,5,9,10] and [1,12,14,20]' do
let(:array_1) { [1,2,3,5,9,10] }
let(:array_2) { [1,12,14,20] }
it { expect(subject.combine).to eq [1,1,2,3,5,9,10,12,14,20] }
end
context 'given: [1,2,3,5,9,10] and [3,3,5,12,14,20]' do
let(:array_1) { [1,2,3,5,9,10] }
let(:array_2) { [3,3,5,12,14,20] }
it { expect(subject.combine).to eq [1,2,3,3,3,5,5,9,10,12,14,20] }
end
context 'given: [1,2,3,4] and [1,2,3,4]' do
let(:array_1) { [1,2,3,4] }
let(:array_2) { [1,2,3,4] }
it { expect(subject.combine).to eq [1,1,2,2,3,3,4,4] }
end
context 'given: [] and [1,2,3,4]' do
let(:array_1) { [] }
let(:array_2) { [1,2,3,4] }
it { expect(subject.combine).to eq [1,2,3,4] }
end
context 'given: [1,2,3,4] and []' do
let(:array_1) { [1,2,3,4] }
let(:array_2) { [] }
it { expect(subject.combine).to eq [1,2,3,4] }
end
end
end