summaryrefslogtreecommitdiff
path: root/spec/unit/python/parsers
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-05-22 09:28:44 -0600
committermo khan <mo.khan@gmail.com>2020-05-25 18:31:06 -0600
commit1ca2a951d05480759af1668ed586793ff5d36a26 (patch)
treeca16267ec26b1d8c3b1a1346a1ab9e8689992116 /spec/unit/python/parsers
parentf8092c7f0ad26d04c8137b3b7d4faea5508a53ce (diff)
Convert from using string paths to using Pathname
* Extract a ./bin/run script * Extract defintion for NEWLINE * Add specs for matching yarn.lock * Add specs for Report * Convert package_manager to pathname * Display path in report * matches? to match?
Diffstat (limited to 'spec/unit/python/parsers')
-rw-r--r--spec/unit/python/parsers/pipfile_lock_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/unit/python/parsers/pipfile_lock_spec.rb b/spec/unit/python/parsers/pipfile_lock_spec.rb
new file mode 100644
index 0000000..59fff52
--- /dev/null
+++ b/spec/unit/python/parsers/pipfile_lock_spec.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+RSpec.describe Spandx::Python::Parsers::PipfileLock do
+ describe '#parse' do
+ subject { described_class.new.parse(path) }
+
+ let(:path) { fixture_file('pip/Pipfile.lock') }
+
+ def build(name, version, path)
+ Spandx::Core::Dependency.new(name: name, version: version, path: path)
+ end
+
+ specify { expect(subject).to match_array([build('six', '1.13.0', path)]) }
+ end
+
+ describe '#match?' do
+ it { is_expected.to be_match(to_path('Pipfile.lock')) }
+ it { is_expected.to be_match(to_path('./Pipfile.lock')) }
+ it { is_expected.to be_match(to_path('/root/Pipfile.lock')) }
+ it { is_expected.not_to be_match(to_path('sitemap.xml')) }
+ it { is_expected.not_to be_match(to_path('/root/notPipfile.lock')) }
+ end
+end