Sha256: 22f74be79e47590d4524446d22c639f61e91f5b4307bc5a07414c6453dc19ea8

Contents?: true

Size: 1.28 KB

Versions: 29

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

describe Ridley::Chef::Chefignore do
  describe "ClassMethods" do
    subject { described_class }

    describe "::find_relative_to" do
      let(:path) { tmp_path.join('chefignore-test') }
      before(:each) { FileUtils.mkdir_p(path) }

      it "finds a chefignore file in a 'cookbooks' directory relative to the given path" do
        FileUtils.touch(path.join('chefignore'))
        subject.find_relative_to(path)
      end

      it "finds a chefignore file relative to the given path" do
        FileUtils.mkdir_p(path.join('cookbooks'))
        FileUtils.touch(path.join('cookbooks', 'chefignore'))
        subject.find_relative_to(path)
      end
    end
  end

  subject { described_class.new(File.join(fixtures_path)) }

  it "loads the globs in the chefignore file" do
    subject.ignores.should =~ %w[recipes/ignoreme.rb ignored]
  end

  it "removes items from an array that match the ignores" do
    file_list = %w[ recipes/ignoreme.rb recipes/dontignoreme.rb ]
    subject.remove_ignores_from(file_list).should == %w[recipes/dontignoreme.rb]
  end

  it "determines if a file is ignored" do
    subject.ignored?('ignored').should be_true
    subject.ignored?('recipes/ignoreme.rb').should be_true
    subject.ignored?('recipes/dontignoreme.rb').should be_false
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
ridley-1.2.6 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.2.5 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.3.2 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.3.1 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.3.0 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.3 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.2.4 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.2.3 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.2.2 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.2.1 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.2.0 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.1.1 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.1.0 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.2 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.1 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.0 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.0.rc3 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.0.rc2 spec/unit/ridley/chef/chefignore_spec.rb
ridley-1.0.0.rc1 spec/unit/ridley/chef/chefignore_spec.rb
ridley-0.12.4 spec/unit/ridley/chef/chefignore_spec.rb