diff options
| author | mo khan <mo.khan@gmail.com> | 2020-03-06 11:33:16 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-03-06 11:33:16 -0700 |
| commit | b4abeb395762cd0370aed4f614aa224db5c15f22 (patch) | |
| tree | 255d4d0331cb9ff6f6cb8d8fdbda3e7a757d37ca /spec | |
| parent | 06cf54374ff826b0fec62bb50e52a38e46c8a81d (diff) | |
fix some pip specs
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/integration/python/pip_spec.rb | 6 | ||||
| -rw-r--r-- | spec/support/integration_test_helper.rb | 7 | ||||
| -rw-r--r-- | spec/support/shared.rb | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/spec/integration/python/pip_spec.rb b/spec/integration/python/pip_spec.rb index 0853a71..a8e4b91 100644 --- a/spec/integration/python/pip_spec.rb +++ b/spec/integration/python/pip_spec.rb @@ -58,9 +58,9 @@ RSpec.describe "pip" do it 'matches the expected report' do runner.clone(url, branch: '48e250a1') report = runner.scan(env: environment) - #expect(report).to match_schema(version: report_version) - expected = JSON.parse(fixture_file_content("expected/#{language}/#{python_version}/#{package_manager}/v#{report_version}.json")) - expect(report).to eql(expected) + content = fixture_file_content("expected/#{language}/#{python_version}/#{package_manager}/v#{report_version}.json") + expect(report).to eq(JSON.parse(content, symbolize_names: true)) + expect(report).to match_schema(version: report_version) end end end diff --git a/spec/support/integration_test_helper.rb b/spec/support/integration_test_helper.rb index 737e988..9ecc8aa 100644 --- a/spec/support/integration_test_helper.rb +++ b/spec/support/integration_test_helper.rb @@ -14,7 +14,10 @@ module IntegrationTestHelper end def clone(repo, branch: 'master') - execute({}, "git clone -b #{branch} #{repo} #{project_path}") + execute({}, "git", "clone", repo, project_path) + Dir.chdir project_path do + execute({}, "git", "checkout", branch) + end end def scan(env: {}) @@ -28,7 +31,7 @@ module IntegrationTestHelper def execute(env = {}, *args) Bundler.with_clean_env do - system(env, *args) + system(env, *args, exception: true) end end diff --git a/spec/support/shared.rb b/spec/support/shared.rb index 9bfd690..8a7590b 100644 --- a/spec/support/shared.rb +++ b/spec/support/shared.rb @@ -7,8 +7,8 @@ RSpec.shared_examples "each report version" do |language, package_manager, branc runner.clone(url, branch: branch) report = runner.scan(env: { 'LM_REPORT_VERSION' => version }) - expected = JSON.parse(fixture_file_content("expected/#{language}/#{package_manager}/v#{version}.json"), symbolize_names: true) - expect(report).to eq(expected) + content = fixture_file_content("expected/#{language}/#{package_manager}/v#{version}.json") + expect(report).to eq(JSON.parse(content, symbolize_names: true)) expect(report).to match_schema(version: version) end end |
