|
1544 | 1544 | end |
1545 | 1545 | end |
1546 | 1546 | end |
| 1547 | + |
| 1548 | + context 'use_lcs is taken into account' do |
| 1549 | + describe '#ignore' do |
| 1550 | + before(:all) do |
| 1551 | + r1 = [ |
| 1552 | + { |
| 1553 | + 'type' => 'Example1', 'title' => 'main', 'tags' => ['stage'], 'exported' => false, |
| 1554 | + 'parameters' => { |
| 1555 | + 'name' => 'main', 'toplevel' => 'toplevel attribute', |
| 1556 | + 'nest' => { |
| 1557 | + 'toplevel' => 'toplevel_nest attribute', |
| 1558 | + 'nest' => { 'nest' => 'nested nested text' }, |
| 1559 | + 'nest2' => { 'chicken' => 'egg' }, |
| 1560 | + 'chicken' => 'egg' |
| 1561 | + } |
| 1562 | + } |
| 1563 | + } |
| 1564 | + ] |
| 1565 | + @c1 = OctocatalogDiff::Spec.build_catalog(r1) |
| 1566 | + @c2 = OctocatalogDiff::Spec.build_catalog(r1) |
| 1567 | + end |
| 1568 | + |
| 1569 | + it 'should honor the algo configuration passed in the options (false)' do |
| 1570 | + logger, logger_str = OctocatalogDiff::Spec.setup_logger |
| 1571 | + opts = { use_lcs: false, logger: logger } |
| 1572 | + testobj = OctocatalogDiff::CatalogDiff::Differ.new(opts, @c1, @c2) |
| 1573 | + testobj.diff |
| 1574 | + expect(logger_str.string).to match(/Entering hashdiff_initial; catalog sizes: 1, 1/) |
| 1575 | + expect(logger_str.string).to match(/HashDiff configuration: \(use_lcs: false\)/) |
| 1576 | + end |
| 1577 | + |
| 1578 | + it 'should honor the algo configuration passed in the options (true)' do |
| 1579 | + logger, logger_str = OctocatalogDiff::Spec.setup_logger |
| 1580 | + opts = { use_lcs: true, logger: logger } |
| 1581 | + testobj = OctocatalogDiff::CatalogDiff::Differ.new(opts, @c1, @c2) |
| 1582 | + testobj.diff |
| 1583 | + expect(logger_str.string).to match(/Entering hashdiff_initial; catalog sizes: 1, 1/) |
| 1584 | + expect(logger_str.string).to match(/HashDiff configuration: \(use_lcs: true\)/) |
| 1585 | + end |
| 1586 | + |
| 1587 | + it 'the default value is true' do |
| 1588 | + logger, logger_str = OctocatalogDiff::Spec.setup_logger |
| 1589 | + opts = { logger: logger } |
| 1590 | + testobj = OctocatalogDiff::CatalogDiff::Differ.new(opts, @c1, @c2) |
| 1591 | + testobj.diff |
| 1592 | + expect(logger_str.string).to match(/Entering hashdiff_initial; catalog sizes: 1, 1/) |
| 1593 | + expect(logger_str.string).to match(/HashDiff configuration: \(use_lcs: true\)/) |
| 1594 | + end |
| 1595 | + end |
| 1596 | + end |
1547 | 1597 | end |
1548 | 1598 | end |
0 commit comments