Sha256: 7e1dad1226a9c27c10f072a9277d81fb889bd89ddbf48d24e54469de5529e2d4

Contents?: true

Size: 1.17 KB

Versions: 10

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe Chef::Sugar::Constraints do
  describe '#version' do
    let(:version) { described_class.version('1.2.3') }

    it 'returns a new version object' do
      expect(version).to be_a(Chef::Sugar::Constraints::Version)
    end

    it 'behaves like a String' do
      expect(version).to be_a(String)
    end

    it 'returns true with the version is satisifed' do
      expect(version).to be_satisfies('~> 1.2.0')
    end

    it 'returns false when the version is not satisfed' do
      expect(version).to_not be_satisfies('~> 2.0.0')
    end
  end

  describe '#constraint' do
    let(:constraint) { described_class.constraint('~> 1.2.0') }

    it 'returns a new constraint object' do
      expect(constraint).to be_a(Chef::Sugar::Constraints::Constraint)
    end

    it 'returns true when the constraint is satisfied' do
      expect(constraint).to be_satisfied_by('1.2.3')
    end

    it 'returns false when the constraint is not satisfied' do
      expect(constraint).to_not be_satisfied_by('2.0.0')
    end
  end

  describe '#chef_version' do
    it 'is a DSL method' do
      expect(Chef::Sugar::DSL).to be_method_defined(:chef_version)
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
chef-sugar-ng-4.2.2 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-4.2.1 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-4.2.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-4.1.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-4.0.1 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-4.0.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.6.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.5.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.4.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.3.0 spec/unit/chef/sugar/constraints_spec.rb