Sha256: 4b6d1563ebee4e3d5304133679554bac53c3213b5885eb114a4189121e5b325e

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require_relative '../test_helper'
require_relative '../../lib/signore/tags'

module Signore
  describe Tags do
    describe '#match?' do
      it 'is a predicate whether the Tags match the given list of tags' do
        tags = %w(programming tech)
        assert Tags.new.match?([])
        assert Tags.new(forbidden: %w(fnord)).match?([])
        assert Tags.new.match?(tags)
        assert Tags.new(required: %w(programming)).match?(tags)
        assert Tags.new(required: %w(programming tech)).match?(tags)
        refute Tags.new(required: %w(programming tech Ruby)).match?(tags)
        refute Tags.new(forbidden: %w(programming)).match?(tags)
        refute Tags.new(forbidden: %w(tech), required: %w(tech)).match?(tags)
      end
    end

    describe '#to_s' do
      it 'returns a CLI-like representation of the Tags' do
        _(Tags.new.to_s).must_equal ''
        _(Tags.new(required: %w(tech)).to_s).must_equal 'tech'
        _(Tags.new(forbidden: %w(fnord)).to_s).must_equal '~fnord'
        _(Tags.new(forbidden: %w(fnord), required: %w(tech)).to_s)
          .must_equal 'tech ~fnord'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
signore-0.6.0 test/signore/tags_test.rb
signore-0.5.0 test/signore/tags_test.rb