Sha256: bd923628fe65c4d5f83d6253caa9551da4ccf1ec1560a10629814e6b0cf16dfc

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
signore-0.7.0 test/signore/tags_test.rb