|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require_relative 'integration_helper' |
| 4 | + |
| 5 | +describe 'script path override' do |
| 6 | + context 'without any scripts' do |
| 7 | + it 'should fail' do |
| 8 | + result = OctocatalogDiff::Integration.integration( |
| 9 | + spec_fact_file: 'facts.yaml', |
| 10 | + argv: [ |
| 11 | + '-n', 'rspec-node.github.net', '--no-parallel', |
| 12 | + '-t', 'ignore-tags-new', '-f', 'ignore-tags-old', |
| 13 | + '--basedir', OctocatalogDiff::Spec.fixture_path('repos/default'), |
| 14 | + '--override-script-path', OctocatalogDiff::Spec.fixture_path('scripts') |
| 15 | + ] |
| 16 | + ) |
| 17 | + expect(result.exitcode).to eq(-1) |
| 18 | + expect(result.logs).to match(/Git checkout error: Git archive ignore-tags-old->/) |
| 19 | + end |
| 20 | + end |
| 21 | + |
| 22 | + context 'with an overridden git-extract.sh script' do |
| 23 | + before(:each) do |
| 24 | + ENV['FIXTURE_DIR'] = OctocatalogDiff::Spec.fixture_path('repos') |
| 25 | + end |
| 26 | + |
| 27 | + after(:each) do |
| 28 | + ENV.delete('FIXTURE_DIR') |
| 29 | + end |
| 30 | + |
| 31 | + it 'should return expected diff' do |
| 32 | + result = OctocatalogDiff::Integration.integration( |
| 33 | + spec_fact_file: 'facts.yaml', |
| 34 | + argv: [ |
| 35 | + '-n', 'rspec-node.github.net', '--no-parallel', |
| 36 | + '-t', 'ignore-tags-new', '-f', 'ignore-tags-old', |
| 37 | + '--basedir', OctocatalogDiff::Spec.fixture_path('repos/default'), |
| 38 | + '--pass-env-vars', 'FIXTURE_DIR', |
| 39 | + '--override-script-path', OctocatalogDiff::Spec.fixture_path('override-scripts') |
| 40 | + ] |
| 41 | + ) |
| 42 | + expect(result.exitcode).to eq(2), OctocatalogDiff::Integration.format_exception(result) |
| 43 | + expect(result.logs).to match(/Selecting.+git-extract.sh from override script path/) |
| 44 | + expect(result.diffs.size).to eq(30) # See ignore_tags_spec.rb |
| 45 | + end |
| 46 | + end |
| 47 | +end |
0 commit comments