Sha256: 39d7ae23fe5473cbf20d2f00d93ad1e0aa13811bf415e196c861f8fd9e209d13

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

include Rake::Funnel::Support

describe Rake::Funnel::Support::AssemblyVersion::FromVersionFiles do
  describe 'defaults' do
    its(:search_pattern) { should == %w(**/VERSION) }
    its(:build_number) { should be_nil }
    its(:sha) { should be_nil }

    describe 'overriding defaults' do
      subject {
        described_class.new({
            search_pattern: 'search pattern',
            build_number: 42,
            sha: 'abc'
          })
      }

      its(:search_pattern) { should == 'search pattern' }
      its(:build_number) { should == 42 }
      its(:sha) { should == 'abc' }
    end
  end

  describe 'enumerable' do
    it { is_expected.to be_kind_of(Enumerable) }
    it { is_expected.to respond_to(:each) }

    it 'should yield enumerator' do
      expect(subject.each).to be_kind_of(Enumerator)
    end
  end

  describe 'enumeration' do
    let(:finder) { double(Finder).as_null_object }
    let(:files) { %w(1 2) }

    before {
      allow(finder).to receive(:all_or_default).and_return(files)
      allow(Finder).to receive(:new).and_return(finder)
    }

    before {
      allow(VersionInfo).to receive(:read_version_from).and_return(*files)
    }

    before {
      allow(Rake).to receive(:rake_output_message)
    }

    subject {
      described_class.new({ build_number: 42, sha: 'abc' })
    }

    it 'should yield source and version info for each file' do
      expect { |b| subject.each(&b) }.to yield_successive_args(
          { source: '1', version_info: VersionInfo.new({ assembly_version: '1', assembly_file_version: '1.42', assembly_informational_version: '1.42-abc' }) },
          { source: '2', version_info: VersionInfo.new({ assembly_version: '2', assembly_file_version: '2.42', assembly_informational_version: '2.42-abc' }) }
        )
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rake-funnel-0.3.2.pre spec/rake/funnel/support/assembly_version/from_version_files_spec.rb
rake-funnel-0.3.1.pre spec/rake/funnel/support/assembly_version/from_version_files_spec.rb
rake-funnel-0.3.0.pre spec/rake/funnel/support/assembly_version/from_version_files_spec.rb
rake-funnel-0.2.0.pre spec/rake/funnel/support/assembly_version/from_version_files_spec.rb
rake-funnel-0.1.0.pre spec/rake/funnel/support/assembly_version/from_version_files_spec.rb