|
25 | 25 | (expect do |block|
|
26 | 26 | subject.with_context(name: 'a') do
|
27 | 27 | expected_contexts = [
|
28 |
| - { history_file: nil, name: 'a' }, |
| 28 | + { history_file: nil, input_library: :readline, name: 'a' }, |
29 | 29 | ]
|
30 | 30 | expect(subject._contexts).to eq(expected_contexts)
|
31 | 31 | block.to_proc.call
|
|
36 | 36 |
|
37 | 37 | context 'when there is an existing stack' do
|
38 | 38 | before(:each) do
|
39 |
| - subject.send(:push_context, history_file: nil, name: 'a') |
| 39 | + subject.send(:push_context, history_file: nil, input_library: :readline, name: 'a') |
40 | 40 | end
|
41 | 41 |
|
42 | 42 | it 'continues to have the previous existing stack' do
|
43 | 43 | subject.with_context {
|
44 | 44 | # noop
|
45 | 45 | }
|
46 | 46 | expected_contexts = [
|
47 |
| - { history_file: nil, name: 'a' }, |
| 47 | + { history_file: nil, input_library: :readline, name: 'a' }, |
48 | 48 | ]
|
49 | 49 | expect(subject._contexts).to eq(expected_contexts)
|
50 | 50 | end
|
|
53 | 53 | (expect do |block|
|
54 | 54 | subject.with_context(name: 'b') do
|
55 | 55 | expected_contexts = [
|
56 |
| - { history_file: nil, name: 'a' }, |
57 |
| - { history_file: nil, name: 'b' }, |
| 56 | + { history_file: nil, input_library: :readline, name: 'a' }, |
| 57 | + { history_file: nil, input_library: :readline, name: 'b' }, |
58 | 58 | ]
|
59 | 59 | expect(subject._contexts).to eq(expected_contexts)
|
60 | 60 | block.to_proc.call
|
|
69 | 69 | }
|
70 | 70 | end.to raise_exception ArgumentError, 'Mock error'
|
71 | 71 | expected_contexts = [
|
72 |
| - { history_file: nil, name: 'a' }, |
| 72 | + { history_file: nil, input_library: :readline, name: 'a' }, |
73 | 73 | ]
|
74 | 74 | expect(subject._contexts).to eq(expected_contexts)
|
75 | 75 | end
|
|
79 | 79 | describe '#push_context' do
|
80 | 80 | context 'when the stack is empty' do
|
81 | 81 | it 'stores the history contexts' do
|
82 |
| - subject.send(:push_context, history_file: nil, name: 'a') |
| 82 | + subject.send(:push_context, history_file: nil, input_library: :readline, name: 'a') |
83 | 83 | expected_contexts = [
|
84 |
| - { history_file: nil, name: 'a' } |
| 84 | + { history_file: nil, input_library: :readline, name: 'a' } |
85 | 85 | ]
|
86 | 86 | expect(subject._contexts).to eq(expected_contexts)
|
87 | 87 | end
|
|
90 | 90 | context 'when multiple values are pushed' do
|
91 | 91 | it 'stores the history contexts' do
|
92 | 92 | subject.send(:push_context, history_file: nil, name: 'a')
|
93 |
| - subject.send(:push_context, history_file: nil, name: 'b') |
94 |
| - subject.send(:push_context, history_file: nil, name: 'c') |
| 93 | + subject.send(:push_context, history_file: nil, input_library: :readline, name: 'b') |
| 94 | + subject.send(:push_context, history_file: nil, input_library: :reline, name: 'c') |
95 | 95 | expected_contexts = [
|
96 |
| - { history_file: nil, name: 'a' }, |
97 |
| - { history_file: nil, name: 'b' }, |
98 |
| - { history_file: nil, name: 'c' }, |
| 96 | + { history_file: nil, input_library: :readline, name: 'a' }, |
| 97 | + { history_file: nil, input_library: :readline, name: 'b' }, |
| 98 | + { history_file: nil, input_library: :reline, name: 'c' }, |
99 | 99 | ]
|
100 | 100 | expect(subject._contexts).to eq(expected_contexts)
|
101 | 101 | end
|
|
113 | 113 | end
|
114 | 114 |
|
115 | 115 | context 'when the stack is not empty' do
|
116 |
| - it 'continues to have an empty stack' do |
| 116 | + it 'continues to have a non-empty stack' do |
117 | 117 | subject.send(:push_context, history_file: nil, name: 'a')
|
118 | 118 | subject.send(:push_context, history_file: nil, name: 'b')
|
119 | 119 | subject.send(:pop_context)
|
120 | 120 | expected_contexts = [
|
121 |
| - { history_file: nil, name: 'a' }, |
| 121 | + { history_file: nil, input_library: :readline, name: 'a' }, |
122 | 122 | ]
|
123 | 123 | expect(subject._contexts).to eq(expected_contexts)
|
124 | 124 | end
|
|
0 commit comments