Sha256: 664cadd3b11ae80210177403faff6bb1f1f5f22c7c96ddf48bbd0c43da05edf7

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

# frozen_string_literal: true

RSpec.describe Licensee::Matchers::Matcher do
  subject { described_class.new(file) }

  let(:mit) { Licensee::License.find('mit') }
  let(:content) { sub_copyright_info(mit) }
  let(:file) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE.txt') }

  it 'stores the file' do
    expect(subject.file).to eql(file)
  end

  it 'returns its name' do
    expect(subject.name).to be(:matcher)
  end

  context 'to_h' do
    class MatcherSpecFixture < Licensee::Matchers::Matcher
      def confidence
        0
      end
    end

    subject { MatcherSpecFixture.new(file) }

    let(:hash) { subject.to_h }
    let(:expected) do
      {
        confidence: 0,
        name:       :matcherspecfixture
      }
    end

    it 'converts to a hash' do
      expect(hash).to eql(expected)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
licensee-9.14.0 spec/licensee/matchers/matcher_spec.rb
licensee-9.13.2 spec/licensee/matchers/matcher_spec.rb
licensee-9.13.1 spec/licensee/matchers/matcher_spec.rb
licensee-9.13.0 spec/licensee/matchers/matcher_spec.rb