|
87 | 87 | context 'with --create-symlinks' do |
88 | 88 | context 'with logger' do |
89 | 89 | it 'should log a warning message and install default symlink' do |
90 | | - logger = double('Logger') |
| 90 | + logger, = OctocatalogDiff::Spec.setup_logger |
91 | 91 | expect(logger).to receive(:warn).with('--create-symlinks is ignored unless --preserve-environments is used') |
92 | 92 |
|
93 | 93 | @described_object.instance_variable_set( |
|
121 | 121 | end |
122 | 122 | end |
123 | 123 |
|
124 | | - context 'with --environment' do |
| 124 | + context 'with --create-symlinks and --environment' do |
125 | 125 | context 'with logger' do |
126 | 126 | it 'should log a warning message and install default symlink' do |
127 | | - logger = double('Logger') |
128 | | - expect(logger).to receive(:warn).with('--environment is ignored unless --preserve-environments is used') |
| 127 | + logger, = OctocatalogDiff::Spec.setup_logger |
| 128 | + expect(logger).to receive(:warn).with( |
| 129 | + '--create-symlinks with --environment ignored unless --preserve-environments is used' |
| 130 | + ) |
129 | 131 |
|
130 | 132 | @described_object.instance_variable_set( |
131 | 133 | '@options', |
132 | 134 | basedir: '/tmp/basedir', |
| 135 | + create_symlinks: %w(foo bar), |
133 | 136 | environment: 'baz' |
134 | 137 | ) |
135 | 138 |
|
|
146 | 149 | @described_object.instance_variable_set( |
147 | 150 | '@options', |
148 | 151 | basedir: '/tmp/basedir', |
| 152 | + create_symlinks: %w(foo bar), |
149 | 153 | environment: 'baz' |
150 | 154 | ) |
151 | 155 |
|
|
157 | 161 | end |
158 | 162 | end |
159 | 163 | end |
| 164 | + context 'with --environment' do |
| 165 | + context 'with logger' do |
| 166 | + it 'should install a symlink to the given environment' do |
| 167 | + logger, = OctocatalogDiff::Spec.setup_logger |
| 168 | + |
| 169 | + @described_object.instance_variable_set( |
| 170 | + '@options', |
| 171 | + basedir: '/tmp/basedir', |
| 172 | + environment: 'baz' |
| 173 | + ) |
| 174 | + |
| 175 | + expect(@described_object) |
| 176 | + .to receive(:install_directory_symlink) |
| 177 | + .with(logger, '/tmp/basedir', 'environments/baz') |
| 178 | + |
| 179 | + expect { @described_object.send(:create_symlinks, logger) }.not_to raise_error |
| 180 | + end |
| 181 | + end |
| 182 | + |
| 183 | + context 'without logger' do |
| 184 | + it 'should install default symlink' do |
| 185 | + @described_object.instance_variable_set( |
| 186 | + '@options', |
| 187 | + basedir: '/tmp/basedir', |
| 188 | + environment: 'baz' |
| 189 | + ) |
| 190 | + |
| 191 | + expect(@described_object) |
| 192 | + .to receive(:install_directory_symlink) |
| 193 | + .with(nil, '/tmp/basedir', 'environments/baz') |
| 194 | + |
| 195 | + expect { @described_object.send(:create_symlinks) }.not_to raise_error |
| 196 | + end |
| 197 | + end |
| 198 | + end |
160 | 199 |
|
161 | 200 | context 'without --create-symlinks or --environment' do |
162 | 201 | it 'should install directory symlink' do |
163 | | - logger = double('Logger') |
| 202 | + logger, = OctocatalogDiff::Spec.setup_logger |
164 | 203 |
|
165 | 204 | @described_object.instance_variable_set( |
166 | 205 | '@options', |
|
0 commit comments