summaryrefslogtreecommitdiff
path: root/spec/unit/core/parser_spec.rb
blob: 9ad5bea9699e0bab5ee07542a2b3054be5034324 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

RSpec.describe Spandx::Core::Parser do
  subject { described_class }

  describe '.for' do
    describe 'when the `composer.lock` file is empty' do
      let(:empty_file) { fixture_file('empty/composer.lock') }
      let(:result) { subject.for(empty_file) }

      specify { expect(result).to be(Spandx::Core::Parser::UNKNOWN) }
    end

    describe 'when the `composer.lock` file is discovered' do
      let(:lock_file) { fixture_file('composer/composer.lock') }
      let(:result) { subject.for(lock_file) }

      specify { expect(result).to be_instance_of(Spandx::Php::Parsers::Composer) }
    end
  end
end