Sha256: 43e711b6d9638ff548571f310963509112b423caf0692f11a91e462ce1d44474

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'
require 'albacore/nugets_pack'
require 'albacore/dsl'
require 'sh_interceptor'

class NGConf
  self.extend Albacore::DSL 
end

describe Albacore::NugetsPack::Cmd, "when calling #execute" do
  subject { 
    cfg = Albacore::NugetsPack::Config.new
    cfg.out = 'src/packages'
    cfg.files = FileList['src/**/*.{csproj,fsproj}']

    cmd = Albacore::NugetsPack::Cmd.new nil, 'NuGet.exe', cfg.opts()
    cmd.extend(ShInterceptor)
    cmd.execute './spec/testdata/example.nuspec'
    cmd
  }

  it "should run the correct thing" do
    expected_args = %W["NuGet.exe" "pack" "-OutputDirectory" "src/packages" "./spec/testdata/example.nuspec"]
    expected_args.unshift '"mono"' unless ::Rake::Win32.windows?
    expected_args = expected_args.to_a.join(' ')
    
    subject.received_args[0].should eq expected_args
  end
end 

describe Albacore::NugetsPack::ProjectTask do
  it "reject .nuspec files" do
    Albacore::NugetsPack::ProjectTask.accept?('some.nuspec').should eq false
  end
end

describe Albacore::NugetsPack::NuspecTask do

  it "accepts .nuspec files" do
    Albacore::NugetsPack::NuspecTask.accept?('some.nuspec').should eq true
  end

  describe "when calling #execute" do
    subject { 
      cfg = Albacore::NugetsPack::Config.new
      cfg.out = 'src/packages'
      cfg.files = FileList['src/**/*.{csproj,fsproj,nuspec}']

      cmd = Albacore::NugetsPack::Cmd.new nil, 'NuGet.exe', cfg.opts()
      cmd.extend(ShInterceptor)

      task = Albacore::NugetsPack::NuspecTask.new cmd, cfg, './spec/testdata/example.nuspec'
      task.execute
      cmd
    }

    it "should run the correct thing" do
      expected_args = %W["NuGet.exe" "pack" "-OutputDirectory" "src/packages" "./spec/testdata/example.nuspec"]
      expected_args.unshift '"mono"' unless ::Rake::Win32.windows?
      expected_args = expected_args.to_a.join(' ')
      
      subject.received_args[0].should eq expected_args
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
albacore-0.6.2.rc1 spec/nugets_pack_spec.rb