Sha256: 6e60e3cdf48ffe72db20c1839039b9040537992a3c43895c9727d26663246d0f

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

RSpec.describe Licensee::Rule do
  let(:groups) { %w(permissions conditions limitations) }

  it 'stores the properties' do
    rule = described_class.new(
      tag:         'tag',
      label:       'label',
      description: 'description',
      group:       'group'
    )

    expect(rule.tag).to eql('tag')
    expect(rule.label).to eql('label')
    expect(rule.description).to eql('description')
    expect(rule.group).to eql('group')
  end

  it 'loads the groups' do
    expect(described_class.groups).to eql(groups)
  end

  it 'loads the raw rules' do
    groups.each do |key|
      expect(described_class.raw_rules).to have_key(key)
    end
  end

  it 'determines the file path' do
    path = described_class.file_path
    expect(File.exist?(path)).to eql(true)
  end

  it 'loads a rule by tag' do
    rule = described_class.find_by_tag('commercial-use')
    expect(rule).to be_a(described_class)
    expect(rule.tag).to eql('commercial-use')
  end

  it 'loads all rules' do
    expect(described_class.all.count).to eql(13)
    rule = described_class.all.first
    expect(rule).to be_a(described_class)
    expect(rule.tag).to eql('commercial-use')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
licensee-8.8.4 spec/licensee/rule.rb
licensee-8.8.3 spec/licensee/rule.rb
licensee-8.8.2 spec/licensee/rule.rb
licensee-8.8.1 spec/licensee/rule.rb
licensee-8.8.0 spec/licensee/rule.rb
licensee-8.7.0 spec/licensee/rule.rb