Sha256: 5c223d3da96e0b07e753c9caf60c9eb91b8e8f200a1f34617e79ab98522eb7ee

Contents?: true

Size: 1.12 KB

Versions: 20

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe Chef::Sugar::Constraints do
  # it_behaves_like 'a chef sugar'

  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 '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

20 entries across 20 versions & 1 rubygems

Version Path
chef-sugar-3.2.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.1.1 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.1.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.0.1 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-3.0.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.5.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.4.1 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.4.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.3.2 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.3.1 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.3.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.2.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.1.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-2.0.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-1.3.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-1.2.6 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-1.2.4 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-1.2.2 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-1.2.0 spec/unit/chef/sugar/constraints_spec.rb
chef-sugar-1.2.0.beta.1 spec/unit/chef/sugar/constraints_spec.rb