Sha256: e69e57c88322abb2377c02c59c9ff15941117d4b80edd9c4e31784d8fe65ee70

Contents?: true

Size: 1.5 KB

Versions: 41

Compression:

Stored size: 1.5 KB

Contents

require 'librarian'
require 'librarian/mock'

module Librarian
  describe Lockfile do

    let(:env) { Mock::Environment.new }

    before do
      env.registry :clear => true do
        source 'source-1' do
          spec 'alpha', '1.1'
        end
      end
    end

    let(:spec) do
      env.dsl do
        src 'source-1'
        dep 'alpha', '1.1'
      end
    end

    let(:resolver) { env.resolver }
    let(:resolution) { resolver.resolve(spec) }

    context "sanity" do
      context "the resolution" do
        subject { resolution }

        it { should be_correct }
        it { should have(1).manifests }
      end
    end

    describe "#save" do
      let(:lockfile) { env.ephemeral_lockfile }
      let(:lockfile_text) { lockfile.save(resolution) }

      context "just saving" do
        it "should return the lockfile text" do
          lockfile_text.should_not be_nil
        end
      end

      context "saving and reloading" do
        let(:reloaded_resolution) { lockfile.load(lockfile_text) }

        it "should have the expected manifests" do
          reloaded_resolution.manifests.count.should == resolution.manifests.count
        end
      end

      context "bouncing" do
        let(:bounced_resolution) { lockfile.load(lockfile_text) }
        let(:bounced_lockfile_text) { lockfile.save(bounced_resolution) }

        it "should return the same lockfile text after bouncing as before bouncing" do
          bounced_lockfile_text.should == lockfile_text
        end
      end
    end

  end
end

Version data entries

41 entries across 41 versions & 4 rubygems

Version Path
librarian-puppet-0.9.2 vendor/librarian/spec/unit/lockfile_spec.rb
librarian-puppet-0.9.2.pre vendor/librarian/spec/unit/lockfile_spec.rb
librarian-0.0.24 spec/unit/lockfile_spec.rb
librarian-puppet-0.9.1 vendor/librarian/spec/unit/lockfile_spec.rb
librarian-puppet-0.9.0 vendor/librarian/spec/unit/lockfile_spec.rb
librarian-puppet-0.0.1.pre2 vendor/librarian/spec/unit/lockfile_spec.rb
librarian-puppet-0.0.1.pre vendor/librarian/spec/unit/lockfile_spec.rb
librarian-0.0.23 spec/unit/lockfile_spec.rb
librarian-0.0.22 spec/unit/lockfile_spec.rb
librarian-0.0.21 spec/unit/lockfile_spec.rb
librarian-0.0.20 spec/unit/lockfile_spec.rb
librarian-0.0.19 spec/unit/lockfile_spec.rb
librarian-0.0.18 spec/unit/lockfile_spec.rb
librarian-0.0.17 spec/unit/lockfile_spec.rb
librarian-0.0.16 spec/unit/lockfile_spec.rb
librarian-0.0.15 spec/unit/lockfile_spec.rb
librarian-0.0.14 spec/unit/lockfile_spec.rb
librarian-0.0.13 spec/unit/lockfile_spec.rb
librarian-0.0.12 spec/unit/lockfile_spec.rb
librarian-0.0.11 spec/unit/lockfile_spec.rb