1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
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 { expect(subject.manifests.size).to eq 1 }
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
expect(lockfile_text).to_not be_nil
end
end
context "saving and reloading" do
let(:reloaded_resolution) { lockfile.load(lockfile_text) }
it "should have the expected manifests" do
expect(reloaded_resolution.manifests.count).to eq 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
expect(bounced_lockfile_text).to eq lockfile_text
end
end
end
end
end
|