|
13 | 13 | let(:loc_2) { { 'file' => '/var/tmp/foo.pp', 'line' => 12 } } |
14 | 14 |
|
15 | 15 | let(:add_1) { ['+', type_title, parameters] } |
16 | | - let(:add_2) { ['+', type_title, parameters, loc_1] } |
| 16 | + let(:add_2) { ['+', type_title, parameters, loc_2] } |
17 | 17 |
|
18 | 18 | let(:del_1) { ['-', type_title, parameters] } |
19 | 19 | let(:del_2) { ['-', type_title, parameters, loc_1] } |
|
165 | 165 | end |
166 | 166 | end |
167 | 167 |
|
168 | | - describe '#old_location' do |
169 | | - end |
| 168 | + describe '#old_file' do |
| 169 | + it 'should return nil for an addition' do |
| 170 | + testobj = described_class.new(add_2) |
| 171 | + expect(testobj.old_file).to be_nil |
| 172 | + end |
170 | 173 |
|
171 | | - describe '#new_location' do |
172 | | - end |
| 174 | + it 'should return the filename for a removal' do |
| 175 | + testobj = described_class.new(del_2) |
| 176 | + expect(testobj.old_file).to eq(loc_1['file']) |
| 177 | + end |
173 | 178 |
|
174 | | - describe '#old_file' do |
| 179 | + it 'should return nil when information is not present for a removal' do |
| 180 | + testobj = described_class.new(del_1) |
| 181 | + expect(testobj.old_file).to be_nil |
| 182 | + end |
| 183 | + |
| 184 | + it 'should return the filename for a change' do |
| 185 | + testobj = described_class.new(chg_2) |
| 186 | + expect(testobj.old_file).to eq(loc_1['file']) |
| 187 | + end |
| 188 | + |
| 189 | + it 'should return nil when information is not present for a change' do |
| 190 | + testobj = described_class.new(chg_1) |
| 191 | + expect(testobj.old_file).to be_nil |
| 192 | + end |
175 | 193 | end |
176 | 194 |
|
177 | 195 | describe '#old_line' do |
| 196 | + it 'should return nil for an addition' do |
| 197 | + testobj = described_class.new(add_2) |
| 198 | + expect(testobj.old_line).to be_nil |
| 199 | + end |
| 200 | + |
| 201 | + it 'should return the line for a removal' do |
| 202 | + testobj = described_class.new(del_2) |
| 203 | + expect(testobj.old_line).to eq(loc_1['line']) |
| 204 | + end |
| 205 | + |
| 206 | + it 'should return nil when information is not present for a removal' do |
| 207 | + testobj = described_class.new(del_1) |
| 208 | + expect(testobj.old_line).to be_nil |
| 209 | + end |
| 210 | + |
| 211 | + it 'should return the line for a change' do |
| 212 | + testobj = described_class.new(chg_2) |
| 213 | + expect(testobj.old_line).to eq(loc_1['line']) |
| 214 | + end |
| 215 | + |
| 216 | + it 'should return nil when information is not present for a change' do |
| 217 | + testobj = described_class.new(chg_1) |
| 218 | + expect(testobj.old_line).to be_nil |
| 219 | + end |
178 | 220 | end |
179 | 221 |
|
180 | 222 | describe '#new_file' do |
| 223 | + it 'should return nil for a removal' do |
| 224 | + testobj = described_class.new(del_2) |
| 225 | + expect(testobj.new_file).to be_nil |
| 226 | + end |
| 227 | + |
| 228 | + it 'should return the filename for an addition' do |
| 229 | + testobj = described_class.new(add_2) |
| 230 | + expect(testobj.new_file).to eq(loc_2['file']) |
| 231 | + end |
| 232 | + |
| 233 | + it 'should return nil when information is not present for an addition' do |
| 234 | + testobj = described_class.new(add_1) |
| 235 | + expect(testobj.new_file).to be_nil |
| 236 | + end |
| 237 | + |
| 238 | + it 'should return the filename for a change' do |
| 239 | + testobj = described_class.new(chg_2) |
| 240 | + expect(testobj.new_file).to eq(loc_2['file']) |
| 241 | + end |
| 242 | + |
| 243 | + it 'should return nil when information is not present for a change' do |
| 244 | + testobj = described_class.new(chg_1) |
| 245 | + expect(testobj.new_file).to be_nil |
| 246 | + end |
181 | 247 | end |
182 | 248 |
|
183 | 249 | describe '#new_line' do |
| 250 | + it 'should return nil for a removal' do |
| 251 | + testobj = described_class.new(del_2) |
| 252 | + expect(testobj.new_line).to be_nil |
| 253 | + end |
| 254 | + |
| 255 | + it 'should return the line for an addition' do |
| 256 | + testobj = described_class.new(add_2) |
| 257 | + expect(testobj.new_line).to eq(loc_2['line']) |
| 258 | + end |
| 259 | + |
| 260 | + it 'should return nil when information is not present for an addition' do |
| 261 | + testobj = described_class.new(add_1) |
| 262 | + expect(testobj.new_line).to be_nil |
| 263 | + end |
| 264 | + |
| 265 | + it 'should return the line for a change' do |
| 266 | + testobj = described_class.new(chg_2) |
| 267 | + expect(testobj.new_line).to eq(loc_2['line']) |
| 268 | + end |
| 269 | + |
| 270 | + it 'should return nil when information is not present for a change' do |
| 271 | + testobj = described_class.new(chg_1) |
| 272 | + expect(testobj.new_line).to be_nil |
| 273 | + end |
184 | 274 | end |
185 | 275 | end |
0 commit comments