cookbook-omnifetch 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/cookbook-omnifetch.rb +2 -2
- data/lib/cookbook-omnifetch/metadata_based_installer.rb +1 -1
- data/lib/cookbook-omnifetch/version.rb +1 -1
- metadata +15 -57
- data/.gitignore +0 -23
- data/.rspec +0 -1
- data/.travis.yml +0 -11
- data/Gemfile +0 -8
- data/README.md +0 -90
- data/Rakefile +0 -19
- data/cookbook-omnifetch.gemspec +0 -39
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/README.md +0 -12
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/metadata.rb +0 -3
- data/spec/fixtures/cookbooks/example_cookbook-0.5.0/recipes/default.rb +0 -8
- data/spec/fixtures/cookbooks/example_cookbook/.gitignore +0 -2
- data/spec/fixtures/cookbooks/example_cookbook/.kitchen.yml +0 -26
- data/spec/fixtures/cookbooks/example_cookbook/Berksfile +0 -1
- data/spec/fixtures/cookbooks/example_cookbook/Berksfile.lock +0 -3
- data/spec/fixtures/cookbooks/example_cookbook/README.md +0 -12
- data/spec/fixtures/cookbooks/example_cookbook/metadata.rb +0 -3
- data/spec/fixtures/cookbooks/example_cookbook/recipes/default.rb +0 -8
- data/spec/spec_helper.rb +0 -43
- data/spec/unit/artifactory_spec.rb +0 -64
- data/spec/unit/artifactserver_spec.rb +0 -116
- data/spec/unit/base_spec.rb +0 -87
- data/spec/unit/chef_server_artifact_spec.rb +0 -110
- data/spec/unit/chef_server_spec.rb +0 -108
- data/spec/unit/exceptions_spec.rb +0 -87
- data/spec/unit/git_spec.rb +0 -290
- data/spec/unit/metadata_based_installer_spec.rb +0 -137
- data/spec/unit/path_spec.rb +0 -119
data/spec/unit/path_spec.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "cookbook-omnifetch/path"
|
3
|
-
|
4
|
-
module CookbookOmnifetch
|
5
|
-
describe PathLocation do
|
6
|
-
let(:relative_paths_root) { File.dirname(__FILE__) }
|
7
|
-
let(:constraint) { double("constraint", satisfies?: true) }
|
8
|
-
let(:dependency) do
|
9
|
-
double("dependency",
|
10
|
-
name: "nginx",
|
11
|
-
version_constraint: constraint,
|
12
|
-
relative_paths_root: relative_paths_root
|
13
|
-
)
|
14
|
-
end
|
15
|
-
let(:path) { fixtures_path.join("cookbooks", "example_cookbook") }
|
16
|
-
let(:relative_path) { Pathname.new("../fixtures/cookbooks/example_cookbook") }
|
17
|
-
|
18
|
-
subject { described_class.new(dependency, path: path) }
|
19
|
-
|
20
|
-
describe "#installed?" do
|
21
|
-
it "returns false" do
|
22
|
-
expect(subject.installed?).to be false
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe "#install" do
|
27
|
-
it "validates the cached cookbook" do
|
28
|
-
expect(subject).to receive(:validate_cached!).with(path)
|
29
|
-
subject.install
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "#cached_cookbook" do
|
34
|
-
it "loads the cached cookbook at the path" do
|
35
|
-
expect(MockCachedCookbook).to receive(:from_path).with(path)
|
36
|
-
subject.cached_cookbook
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe "#relative_path" do
|
41
|
-
it "returns the path to the Berksfile" do
|
42
|
-
expect(subject.relative_path).to eq(relative_path)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
describe "#expanded_path" do
|
47
|
-
it "returns the expanded path, relative to the Berksfile" do
|
48
|
-
absolute_path = Pathname.new(File.expand_path(relative_path, relative_paths_root))
|
49
|
-
expect(subject.expanded_path).to eq(absolute_path)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe "#==" do
|
54
|
-
it "is false when compared with a non-PathLocation" do
|
55
|
-
this = PathLocation.new(dependency, path: ".")
|
56
|
-
that = "A string"
|
57
|
-
expect(this).to_not eq(that)
|
58
|
-
end
|
59
|
-
|
60
|
-
it "is false when the metadata? is not the same" do
|
61
|
-
this = PathLocation.new(dependency, path: ".")
|
62
|
-
that = PathLocation.new(dependency, path: ".", metadata: true)
|
63
|
-
expect(this).to_not eq(that)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "is false when the expanded paths are different" do
|
67
|
-
this = PathLocation.new(dependency, path: ".")
|
68
|
-
that = PathLocation.new(dependency, path: "..")
|
69
|
-
expect(this).to_not eq(that)
|
70
|
-
end
|
71
|
-
|
72
|
-
it "is true when they are the same" do
|
73
|
-
this = PathLocation.new(dependency, path: ".", metadata: true)
|
74
|
-
that = PathLocation.new(dependency, path: ".", metadata: true)
|
75
|
-
expect(this).to eq(that)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
describe "#to_lock" do
|
80
|
-
it "includes the path relative to the Berksfile" do
|
81
|
-
expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/, "")
|
82
|
-
path: #{relative_path}
|
83
|
-
EOH
|
84
|
-
end
|
85
|
-
|
86
|
-
it "includes the metadata attribute" do
|
87
|
-
subject.stub(:metadata?).and_return(true)
|
88
|
-
expect(subject.to_lock).to eq <<-EOH.gsub(/^ {10}/, "")
|
89
|
-
path: #{relative_path}
|
90
|
-
metadata: true
|
91
|
-
EOH
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
describe "#lock_data" do
|
96
|
-
it "includes the path relative to the Berksfile" do
|
97
|
-
expect(subject.lock_data).to eq({ "path" => relative_path.to_s })
|
98
|
-
end
|
99
|
-
|
100
|
-
it "includes the metadata attribute" do
|
101
|
-
subject.stub(:metadata?).and_return(true)
|
102
|
-
expect(subject.lock_data).to eq({ "path" => relative_path.to_s, "metadata" => true })
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
describe "#to_s" do
|
107
|
-
it "uses the relative path" do
|
108
|
-
expect(subject.to_s).to eq("source at #{relative_path}")
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "#inspect" do
|
113
|
-
it "includes the right information" do
|
114
|
-
subject.stub(:metadata?).and_return(true)
|
115
|
-
expect(subject.inspect).to eq("#<CookbookOmnifetch::PathLocation metadata: true, path: #{relative_path}>")
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
end
|