librarian 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -2
- data/CHANGELOG.md +15 -0
- data/Gemfile +2 -0
- data/VERSION +1 -0
- data/lib/librarian/algorithms.rb +133 -0
- data/lib/librarian/cli/manifest_presenter.rb +1 -5
- data/lib/librarian/dependency.rb +7 -1
- data/lib/librarian/environment.rb +20 -2
- data/lib/librarian/environment/runtime_cache.rb +101 -0
- data/lib/librarian/manifest.rb +7 -1
- data/lib/librarian/manifest_set.rb +11 -12
- data/lib/librarian/posix.rb +14 -5
- data/lib/librarian/resolver.rb +22 -9
- data/lib/librarian/resolver/implementation.rb +64 -49
- data/lib/librarian/source/git.rb +47 -11
- data/lib/librarian/source/git/repository.rb +33 -3
- data/lib/librarian/version.rb +1 -1
- data/librarian.gemspec +8 -6
- data/spec/functional/cli_spec.rb +1 -1
- data/spec/functional/posix_spec.rb +6 -8
- data/spec/functional/source/git/repository_spec.rb +55 -27
- data/spec/functional/source/git_spec.rb +152 -8
- data/spec/support/project_path_macro.rb +14 -0
- data/spec/unit/action/base_spec.rb +1 -1
- data/spec/unit/action/clean_spec.rb +6 -6
- data/spec/unit/action/install_spec.rb +5 -5
- data/spec/unit/algorithms_spec.rb +131 -0
- data/spec/unit/config/database_spec.rb +38 -38
- data/spec/unit/dependency/requirement_spec.rb +12 -0
- data/spec/unit/dsl_spec.rb +49 -49
- data/spec/unit/environment/runtime_cache_spec.rb +73 -0
- data/spec/unit/environment_spec.rb +28 -28
- data/spec/unit/lockfile/parser_spec.rb +18 -18
- data/spec/unit/lockfile_spec.rb +3 -3
- data/spec/unit/manifest/version_spec.rb +11 -0
- data/spec/unit/manifest_set_spec.rb +20 -20
- data/spec/unit/mock/environment_spec.rb +4 -4
- data/spec/unit/resolver_spec.rb +61 -20
- data/spec/unit/spec_change_set_spec.rb +19 -19
- metadata +19 -5
@@ -0,0 +1,73 @@
|
|
1
|
+
require "librarian/environment/runtime_cache"
|
2
|
+
|
3
|
+
module Librarian
|
4
|
+
class Environment
|
5
|
+
describe RuntimeCache do
|
6
|
+
|
7
|
+
let(:rtc) { described_class.new }
|
8
|
+
let(:key) { ["brah", "nick"] }
|
9
|
+
let(:key_x) { ["brah", "phar"] }
|
10
|
+
let(:key_y) { ["rost", "phar"] }
|
11
|
+
|
12
|
+
def triple(keypair)
|
13
|
+
[rtc.include?(*keypair), rtc.get(*keypair), rtc.memo(*keypair){yield}]
|
14
|
+
end
|
15
|
+
|
16
|
+
context "originally" do
|
17
|
+
specify { expect(triple(key){9}).to eql([false, nil, 9]) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context "after put" do
|
21
|
+
before { rtc.put(*key){6} }
|
22
|
+
|
23
|
+
specify { expect(triple(key){9}).to eql([true, 6, 6]) }
|
24
|
+
specify { expect(triple(key_x){9}).to eql([false, nil, 9]) }
|
25
|
+
specify { expect(triple(key_y){9}).to eql([false, nil, 9]) }
|
26
|
+
end
|
27
|
+
|
28
|
+
context "after put then delete" do
|
29
|
+
before { rtc.put(*key){6} }
|
30
|
+
before { rtc.delete *key }
|
31
|
+
|
32
|
+
specify { expect(triple(key){9}).to eql([false, nil, 9]) }
|
33
|
+
specify { expect(triple(key_x){9}).to eql([false, nil, 9]) }
|
34
|
+
specify { expect(triple(key_y){9}).to eql([false, nil, 9]) }
|
35
|
+
end
|
36
|
+
|
37
|
+
context "after memo" do
|
38
|
+
before { rtc.memo(*key){6} }
|
39
|
+
|
40
|
+
specify { expect(triple(key){9}).to eql([true, 6, 6]) }
|
41
|
+
specify { expect(triple(key_x){9}).to eql([false, nil, 9]) }
|
42
|
+
specify { expect(triple(key_y){9}).to eql([false, nil, 9]) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "after memo then delete" do
|
46
|
+
before { rtc.memo(*key){6} }
|
47
|
+
before { rtc.delete *key }
|
48
|
+
|
49
|
+
specify { expect(triple(key){9}).to eql([false, nil, 9]) }
|
50
|
+
specify { expect(triple(key_x){9}).to eql([false, nil, 9]) }
|
51
|
+
specify { expect(triple(key_y){9}).to eql([false, nil, 9]) }
|
52
|
+
end
|
53
|
+
|
54
|
+
context "with keyspace wrapper" do
|
55
|
+
let(:krtc) { rtc.keyspace("brah") }
|
56
|
+
let(:key) { "nick" }
|
57
|
+
let(:key_x) { "phar" }
|
58
|
+
|
59
|
+
def triple(keypair)
|
60
|
+
[krtc.include?(key), krtc.get(key), krtc.memo(key){yield}]
|
61
|
+
end
|
62
|
+
|
63
|
+
context "after put" do
|
64
|
+
before { krtc.put(key){6} }
|
65
|
+
|
66
|
+
specify { expect(triple(key){9}).to eql([true, 6, 6]) }
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -9,15 +9,15 @@ module Librarian
|
|
9
9
|
let(:env) { described_class.new }
|
10
10
|
|
11
11
|
describe "#adapter_module" do
|
12
|
-
specify { env.adapter_module.
|
12
|
+
specify { expect(env.adapter_module).to be nil }
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "#adapter_name" do
|
16
|
-
specify { env.adapter_name.
|
16
|
+
specify { expect(env.adapter_name).to be nil }
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "#adapter_version" do
|
20
|
-
specify { env.adapter_version.
|
20
|
+
specify { expect(env.adapter_version).to be nil }
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "computing the home" do
|
@@ -27,7 +27,7 @@ module Librarian
|
|
27
27
|
|
28
28
|
it "finds the home" do
|
29
29
|
env.stub(:adapter_name).and_return("cat")
|
30
|
-
env.config_db.underlying_home.to_s.
|
30
|
+
expect(env.config_db.underlying_home.to_s).to eq "/path/to/home"
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -37,7 +37,7 @@ module Librarian
|
|
37
37
|
|
38
38
|
it "finds the home" do
|
39
39
|
env.stub(:adapter_name).and_return("cat")
|
40
|
-
env.config_db.underlying_home.to_s.
|
40
|
+
expect(env.config_db.underlying_home.to_s).to eq real_home
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -49,7 +49,7 @@ module Librarian
|
|
49
49
|
with_env "http_proxy" => nil
|
50
50
|
|
51
51
|
it "should have a nil http proxy uri" do
|
52
|
-
env.http_proxy_uri.
|
52
|
+
expect(env.http_proxy_uri).to be_nil
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -57,19 +57,19 @@ module Librarian
|
|
57
57
|
with_env "http_proxy" => "admin:secret@example.com"
|
58
58
|
|
59
59
|
it "should have the expcted http proxy uri" do
|
60
|
-
env.http_proxy_uri.
|
60
|
+
expect(env.http_proxy_uri).to eq URI("http://admin:secret@example.com")
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should have the expected host" do
|
64
|
-
env.http_proxy_uri.host.
|
64
|
+
expect(env.http_proxy_uri.host).to eq "example.com"
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should have the expected user" do
|
68
|
-
env.http_proxy_uri.user.
|
68
|
+
expect(env.http_proxy_uri.user).to eq "admin"
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should have the expected password" do
|
72
|
-
env.http_proxy_uri.password.
|
72
|
+
expect(env.http_proxy_uri.password).to eq "secret"
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
@@ -79,7 +79,7 @@ module Librarian
|
|
79
79
|
"http_proxy_pass" => "secret"
|
80
80
|
|
81
81
|
it "should have the expcted http proxy uri" do
|
82
|
-
env.http_proxy_uri.
|
82
|
+
expect(env.http_proxy_uri).to eq URI("http://admin:secret@example.com")
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
@@ -91,11 +91,11 @@ module Librarian
|
|
91
91
|
with_env "http_proxy" => nil
|
92
92
|
|
93
93
|
it "should have the normal class" do
|
94
|
-
env.net_http_class(proxied_host).
|
94
|
+
expect(env.net_http_class(proxied_host)).to be Net::HTTP
|
95
95
|
end
|
96
96
|
|
97
97
|
it "should not be marked as a proxy class" do
|
98
|
-
env.net_http_class(proxied_host).
|
98
|
+
expect(env.net_http_class(proxied_host)).to_not be_proxy_class
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
@@ -103,18 +103,18 @@ module Librarian
|
|
103
103
|
with_env "http_proxy" => "admin:secret@example.com"
|
104
104
|
|
105
105
|
it "should not by marked as a proxy class for localhost" do
|
106
|
-
env.net_http_class('localhost').
|
106
|
+
expect(env.net_http_class('localhost')).to_not be_proxy_class
|
107
107
|
end
|
108
108
|
it "should not have the normal class" do
|
109
|
-
env.net_http_class(proxied_host).
|
109
|
+
expect(env.net_http_class(proxied_host)).to_not be Net::HTTP
|
110
110
|
end
|
111
111
|
|
112
112
|
it "should have a subclass the normal class" do
|
113
|
-
env.net_http_class(proxied_host).
|
113
|
+
expect(env.net_http_class(proxied_host)).to be < Net::HTTP
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should be marked as a proxy class" do
|
117
|
-
env.net_http_class(proxied_host).
|
117
|
+
expect(env.net_http_class(proxied_host)).to be_proxy_class
|
118
118
|
end
|
119
119
|
|
120
120
|
it "should have the expected proxy attributes" do
|
@@ -132,7 +132,7 @@ module Librarian
|
|
132
132
|
"pass" => http.proxy_pass,
|
133
133
|
}
|
134
134
|
|
135
|
-
actual_attributes.
|
135
|
+
expect(actual_attributes).to eq expected_attributes
|
136
136
|
end
|
137
137
|
|
138
138
|
end
|
@@ -145,11 +145,11 @@ module Librarian
|
|
145
145
|
let(:proxied_host) { "noproxy.com" }
|
146
146
|
|
147
147
|
it "should have the normal class" do
|
148
|
-
env.net_http_class(proxied_host).
|
148
|
+
expect(env.net_http_class(proxied_host)).to be Net::HTTP
|
149
149
|
end
|
150
150
|
|
151
151
|
it "should not be marked as a proxy class" do
|
152
|
-
env.net_http_class(proxied_host).
|
152
|
+
expect(env.net_http_class(proxied_host)).to_not be_proxy_class
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
@@ -157,11 +157,11 @@ module Librarian
|
|
157
157
|
let(:proxied_host) { "www.noproxy.com" }
|
158
158
|
|
159
159
|
it "should have the normal class" do
|
160
|
-
env.net_http_class(proxied_host).
|
160
|
+
expect(env.net_http_class(proxied_host)).to be Net::HTTP
|
161
161
|
end
|
162
162
|
|
163
163
|
it "should not be marked as a proxy class" do
|
164
|
-
env.net_http_class(proxied_host).
|
164
|
+
expect(env.net_http_class(proxied_host)).to_not be_proxy_class
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
@@ -169,11 +169,11 @@ module Librarian
|
|
169
169
|
let(:proxied_host) { "localhost" }
|
170
170
|
|
171
171
|
it "should have the normal class" do
|
172
|
-
env.net_http_class(proxied_host).
|
172
|
+
expect(env.net_http_class(proxied_host)).to be Net::HTTP
|
173
173
|
end
|
174
174
|
|
175
175
|
it "should not be marked as a proxy class" do
|
176
|
-
env.net_http_class(proxied_host).
|
176
|
+
expect(env.net_http_class(proxied_host)).to_not be_proxy_class
|
177
177
|
end
|
178
178
|
end
|
179
179
|
|
@@ -181,11 +181,11 @@ module Librarian
|
|
181
181
|
let(:proxied_host) { "127.0.0.1" }
|
182
182
|
|
183
183
|
it "should have the normal class" do
|
184
|
-
env.net_http_class(proxied_host).
|
184
|
+
expect(env.net_http_class(proxied_host)).to be Net::HTTP
|
185
185
|
end
|
186
186
|
|
187
187
|
it "should not be marked as a proxy class" do
|
188
|
-
env.net_http_class(proxied_host).
|
188
|
+
expect(env.net_http_class(proxied_host)).to_not be_proxy_class
|
189
189
|
end
|
190
190
|
end
|
191
191
|
|
@@ -193,11 +193,11 @@ module Librarian
|
|
193
193
|
let(:proxied_host) { "www.example.com" }
|
194
194
|
|
195
195
|
it "should have a subclass the normal class" do
|
196
|
-
env.net_http_class(proxied_host).
|
196
|
+
expect(env.net_http_class(proxied_host)).to be < Net::HTTP
|
197
197
|
end
|
198
198
|
|
199
199
|
it "should be marked as a proxy class" do
|
200
|
-
env.net_http_class(proxied_host).
|
200
|
+
expect(env.net_http_class(proxied_host)).to be_proxy_class
|
201
201
|
end
|
202
202
|
end
|
203
203
|
|
@@ -22,11 +22,11 @@ module Librarian
|
|
22
22
|
end
|
23
23
|
|
24
24
|
it "should give an empty list of dependencies" do
|
25
|
-
resolution.dependencies.
|
25
|
+
expect(resolution.dependencies).to be_empty
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should give an empty list of manifests" do
|
29
|
-
resolution.manifests.
|
29
|
+
expect(resolution.manifests).to be_empty
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -45,56 +45,56 @@ module Librarian
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should give a list of one dependency" do
|
48
|
-
resolution.
|
48
|
+
expect(resolution).to have(1).dependencies
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should give a dependency with the expected name" do
|
52
52
|
dependency = resolution.dependencies.first
|
53
53
|
|
54
|
-
dependency.name.
|
54
|
+
expect(dependency.name).to eq "jelly"
|
55
55
|
end
|
56
56
|
|
57
57
|
it "should give a dependency with the expected requirement" do
|
58
58
|
dependency = resolution.dependencies.first
|
59
59
|
|
60
60
|
# Note: it must be this order because this order is lexicographically sorted.
|
61
|
-
dependency.requirement.to_s.
|
61
|
+
expect(dependency.requirement.to_s).to eq "!= 1.2.6, ~> 1.1"
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should give a dependency wth the expected source" do
|
65
65
|
dependency = resolution.dependencies.first
|
66
66
|
source = dependency.source
|
67
67
|
|
68
|
-
source.name.
|
68
|
+
expect(source.name).to eq "source-a"
|
69
69
|
end
|
70
70
|
|
71
71
|
it "should give a list of one manifest" do
|
72
|
-
resolution.
|
72
|
+
expect(resolution).to have(1).manifests
|
73
73
|
end
|
74
74
|
|
75
75
|
it "should give a manifest with the expected name" do
|
76
76
|
manifest = resolution.manifests.first
|
77
77
|
|
78
|
-
manifest.name.
|
78
|
+
expect(manifest.name).to eq "jelly"
|
79
79
|
end
|
80
80
|
|
81
81
|
it "should give a manifest with the expected version" do
|
82
82
|
manifest = resolution.manifests.first
|
83
83
|
|
84
|
-
manifest.version.to_s.
|
84
|
+
expect(manifest.version.to_s).to eq "1.3.5"
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should give a manifest with no dependencies" do
|
88
88
|
manifest = resolution.manifests.first
|
89
89
|
|
90
|
-
manifest.dependencies.
|
90
|
+
expect(manifest.dependencies).to be_empty
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should give a manifest with the expected source" do
|
94
94
|
manifest = resolution.manifests.first
|
95
95
|
source = manifest.source
|
96
96
|
|
97
|
-
source.name.
|
97
|
+
expect(source.name).to eq "source-a"
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should give the dependency and the manifest the same source instance" do
|
@@ -104,7 +104,7 @@ module Librarian
|
|
104
104
|
dependency_source = dependency.source
|
105
105
|
manifest_source = manifest.source
|
106
106
|
|
107
|
-
manifest_source.
|
107
|
+
expect(manifest_source).to be dependency_source
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -125,36 +125,36 @@ module Librarian
|
|
125
125
|
end
|
126
126
|
|
127
127
|
it "should give a list of one dependency" do
|
128
|
-
resolution.
|
128
|
+
expect(resolution).to have(1).dependencies
|
129
129
|
end
|
130
130
|
|
131
131
|
it "should have the expected dependency" do
|
132
132
|
dependency = resolution.dependencies.first
|
133
133
|
|
134
|
-
dependency.name.
|
134
|
+
expect(dependency.name).to eq "jelly"
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should give a list of all the manifests" do
|
138
|
-
resolution.
|
138
|
+
expect(resolution).to have(2).manifests
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should include all the expected manifests" do
|
142
142
|
manifests = ManifestSet.new(resolution.manifests)
|
143
143
|
|
144
|
-
manifests.to_hash.keys.
|
144
|
+
expect(manifests.to_hash.keys).to match_array( %w(butter jelly) )
|
145
145
|
end
|
146
146
|
|
147
147
|
it "should have an internally consistent set of manifests" do
|
148
148
|
manifests = ManifestSet.new(resolution.manifests)
|
149
149
|
|
150
|
-
manifests.
|
150
|
+
expect(manifests).to be_consistent
|
151
151
|
end
|
152
152
|
|
153
153
|
it "should have an externally consistent set of manifests" do
|
154
154
|
dependencies = resolution.dependencies
|
155
155
|
manifests = ManifestSet.new(resolution.manifests)
|
156
156
|
|
157
|
-
manifests.
|
157
|
+
expect(manifests).to be_in_compliance_with dependencies
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
data/spec/unit/lockfile_spec.rb
CHANGED
@@ -39,7 +39,7 @@ module Librarian
|
|
39
39
|
|
40
40
|
context "just saving" do
|
41
41
|
it "should return the lockfile text" do
|
42
|
-
lockfile_text.
|
42
|
+
expect(lockfile_text).to_not be_nil
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -47,7 +47,7 @@ module Librarian
|
|
47
47
|
let(:reloaded_resolution) { lockfile.load(lockfile_text) }
|
48
48
|
|
49
49
|
it "should have the expected manifests" do
|
50
|
-
reloaded_resolution.manifests.count.
|
50
|
+
expect(reloaded_resolution.manifests.count).to eq resolution.manifests.count
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -56,7 +56,7 @@ module Librarian
|
|
56
56
|
let(:bounced_lockfile_text) { lockfile.save(bounced_resolution) }
|
57
57
|
|
58
58
|
it "should return the same lockfile text after bouncing as before bouncing" do
|
59
|
-
bounced_lockfile_text.
|
59
|
+
expect(bounced_lockfile_text).to eq lockfile_text
|
60
60
|
end
|
61
61
|
end
|
62
62
|
end
|
@@ -15,11 +15,11 @@ module Librarian
|
|
15
15
|
let(:set) { described_class.new(array) }
|
16
16
|
|
17
17
|
it "should give back the array" do
|
18
|
-
set.to_a.
|
18
|
+
expect(set.to_a).to match_array( array )
|
19
19
|
end
|
20
20
|
|
21
21
|
it "should give back the hash" do
|
22
|
-
set.to_hash.
|
22
|
+
expect(set.to_hash).to eq hash
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -27,11 +27,11 @@ module Librarian
|
|
27
27
|
let(:set) { described_class.new(hash) }
|
28
28
|
|
29
29
|
it "should give back the array" do
|
30
|
-
set.to_a.
|
30
|
+
expect(set.to_a).to match_array( array )
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should give back the hash" do
|
34
|
-
set.to_hash.
|
34
|
+
expect(set.to_hash).to eq hash
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -48,19 +48,19 @@ module Librarian
|
|
48
48
|
it "should not do anything when given no names" do
|
49
49
|
set.shallow_strip!([])
|
50
50
|
|
51
|
-
set.to_a.
|
51
|
+
expect(set.to_a).to match_array( [jelly, butter, jam] )
|
52
52
|
end
|
53
53
|
|
54
54
|
it "should remove only the named elements" do
|
55
55
|
set.shallow_strip!(["butter", "jam"])
|
56
56
|
|
57
|
-
set.to_a.
|
57
|
+
expect(set.to_a).to match_array( [jelly] )
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should allow removing all the elements" do
|
61
61
|
set.shallow_strip!(["jelly", "butter", "jam"])
|
62
62
|
|
63
|
-
set.to_a.
|
63
|
+
expect(set.to_a).to match_array( [] )
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -76,19 +76,19 @@ module Librarian
|
|
76
76
|
it "should empty the set when given no names" do
|
77
77
|
set.shallow_keep!([])
|
78
78
|
|
79
|
-
set.to_a.
|
79
|
+
expect(set.to_a).to match_array( [] )
|
80
80
|
end
|
81
81
|
|
82
82
|
it "should keep only the named elements" do
|
83
83
|
set.shallow_keep!(["butter", "jam"])
|
84
84
|
|
85
|
-
set.to_a.
|
85
|
+
expect(set.to_a).to match_array( [butter, jam] )
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should allow keeping all the elements" do
|
89
89
|
set.shallow_keep!(["jelly", "butter", "jam"])
|
90
90
|
|
91
|
-
set.to_a.
|
91
|
+
expect(set.to_a).to match_array( [jelly, butter, jam] )
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
@@ -117,31 +117,31 @@ module Librarian
|
|
117
117
|
it "should not do anything when given no names" do
|
118
118
|
set.deep_strip!([])
|
119
119
|
|
120
|
-
set.to_a.
|
120
|
+
expect(set.to_a).to match_array( [a, b, c, d, e, f, g, h] )
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should remove just the named elements if they have no dependencies" do
|
124
124
|
set.deep_strip!(["c", "h"])
|
125
125
|
|
126
|
-
set.to_a.
|
126
|
+
expect(set.to_a).to match_array( [a, b, d, e, f, g] )
|
127
127
|
end
|
128
128
|
|
129
129
|
it "should remove the named elements and all their dependencies" do
|
130
130
|
set.deep_strip!(["b"])
|
131
131
|
|
132
|
-
set.to_a.
|
132
|
+
expect(set.to_a).to match_array( [a, e, f, g, h] )
|
133
133
|
end
|
134
134
|
|
135
135
|
it "should remove an entire tree of dependencies" do
|
136
136
|
set.deep_strip!(["e"])
|
137
137
|
|
138
|
-
set.to_a.
|
138
|
+
expect(set.to_a).to match_array( [a, b, c, d] )
|
139
139
|
end
|
140
140
|
|
141
141
|
it "should allow removing all the elements" do
|
142
142
|
set.deep_strip!(["a", "e"])
|
143
143
|
|
144
|
-
set.to_a.
|
144
|
+
expect(set.to_a).to match_array( [] )
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
@@ -170,31 +170,31 @@ module Librarian
|
|
170
170
|
it "should remove all the elements when given no names" do
|
171
171
|
set.deep_keep!([])
|
172
172
|
|
173
|
-
set.to_a.
|
173
|
+
expect(set.to_a).to match_array( [] )
|
174
174
|
end
|
175
175
|
|
176
176
|
it "should keep just the named elements if they have no dependencies" do
|
177
177
|
set.deep_keep!(["c", "h"])
|
178
178
|
|
179
|
-
set.to_a.
|
179
|
+
expect(set.to_a).to match_array( [c, h] )
|
180
180
|
end
|
181
181
|
|
182
182
|
it "should keep the named elements and all their dependencies" do
|
183
183
|
set.deep_keep!(["b"])
|
184
184
|
|
185
|
-
set.to_a.
|
185
|
+
expect(set.to_a).to match_array( [b, c, d] )
|
186
186
|
end
|
187
187
|
|
188
188
|
it "should keep an entire tree of dependencies" do
|
189
189
|
set.deep_keep!(["e"])
|
190
190
|
|
191
|
-
set.to_a.
|
191
|
+
expect(set.to_a).to match_array( [e, f, g, h] )
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should allow keeping all the elements" do
|
195
195
|
set.deep_keep!(["a", "e"])
|
196
196
|
|
197
|
-
set.to_a.
|
197
|
+
expect(set.to_a).to match_array( [a, b, c, d, e, f, g, h] )
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|