Sha256: cd5452cdd2b3e88340b5bf0aa084394508ac9eb26133f86a8c259efd7b2994c7

Contents?: true

Size: 1.46 KB

Versions: 54

Compression:

Stored size: 1.46 KB

Contents

require 'albacore/paths'

shared_context 'package_metadata_dsl' do
  let :m do
    subject.metadata
  end

  def self.has_value sym, e
    it "should have overridden #{sym}, to be #{e}" do
      m.send(sym).should eq e
    end
  end

  def self.has_dep name, version
    it "has dependency on '#{name}'" do
      expect(m.dependencies.has_key?(name)).to be true
    end
    it "overrode dependency on '#{name}'" do
      expect(m.dependencies[name].version).to eq version
    end
  end

  def self.has_not_dep name
    it "does not have a dependency on #{name}" do
      expect(m.dependencies.has_key?(name)).to be false
    end
  end

  def self.has_file src, target, exclude = nil
    src, target = norm(src), norm(target)
    it "has file[#{src}] (should not be nil)" do
      file = subject.files.find { |f| f.src == src }
     #  puts "## ALL FILES ##"
     #  subject.files.each do |f|
     #    puts "subject.files: #{subject.files}, index of: #{subject.files.find_index { |f| f.src == src }}"
     #    puts "#{f.inspect}"
     #  end
      expect(file).to_not be nil
    end

    it "has file[#{src}].target == '#{target}'" do
      file = subject.files.find { |f| f.src == src }
      expect(file.target).to eq target
    end 
  end

  def self.has_not_file src
    src = norm src
    it "has not file[#{src}]" do
      file = subject.files.find { |f| f.src == src }
      expect(file).to be nil
    end
  end

  def self.norm str
    Albacore::Paths.normalise_slashes str
  end  
end

Version data entries

54 entries across 54 versions & 1 rubygems

Version Path
albacore-2.4.2 spec/shared_contexts.rb
albacore-2.4.1 spec/shared_contexts.rb
albacore-2.4.0 spec/shared_contexts.rb
albacore-2.3.22 spec/shared_contexts.rb
albacore-2.3.21 spec/shared_contexts.rb
albacore-2.3.20 spec/shared_contexts.rb
albacore-2.3.19 spec/shared_contexts.rb
albacore-2.3.18 spec/shared_contexts.rb
albacore-2.3.17 spec/shared_contexts.rb
albacore-2.3.16 spec/shared_contexts.rb
albacore-2.3.15 spec/shared_contexts.rb
albacore-2.3.14 spec/shared_contexts.rb
albacore-2.3.13 spec/shared_contexts.rb
albacore-2.3.12 spec/shared_contexts.rb
albacore-2.3.11 spec/shared_contexts.rb
albacore-2.3.10 spec/shared_contexts.rb
albacore-2.3.9 spec/shared_contexts.rb
albacore-2.3.8 spec/shared_contexts.rb
albacore-2.3.7 spec/shared_contexts.rb
albacore-2.3.6 spec/shared_contexts.rb