spec/unit/source/git_spec.rb in r10k-1.3.5 vs spec/unit/source/git_spec.rb in r10k-1.4.0
- old
+ new
@@ -30,18 +30,18 @@
end
it "generates environments when the cache is present and environments have not been loaded" do
allow(subject.cache).to receive(:cached?).and_return true
allow(subject).to receive(:generate_environments).and_return %w[hi]
- expect(subject.environments).to have(1).items
+ expect(subject.environments.size).to eq(1)
end
it "doesn't recreate environments if they have already been loaded" do
allow(subject.cache).to receive(:cached?).and_return true
allow(subject).to receive(:generate_environments).once.and_return %w[hi]
- expect(subject.environments).to have(1).items
- expect(subject.environments).to have(1).items
+ expect(subject.environments.size).to eq(1)
+ expect(subject.environments.size).to eq(1)
end
end
describe "eagerly generating environments" do
before do
@@ -49,11 +49,11 @@
end
let(:master_env) { subject.generate_environments.first }
it "creates an environment for each branch" do
- expect(subject.generate_environments).to have(1).items
+ expect(subject.generate_environments.size).to eq(1)
end
it "copies the source remote to the environment" do
expect(master_env.remote).to eq subject.remote
end
@@ -77,11 +77,11 @@
before do
allow(subject.cache).to receive(:branches).and_return ['master', 'invalid-branch']
end
it "creates an environment for each branch" do
- expect(subject.generate_environments).to have(2).items
+ expect(subject.generate_environments.size).to eq(2)
end
it "removes invalid characters from branch names" do
invalid_env = subject.generate_environments.last
expect(invalid_env.dirname).to eq 'invalid_branch'
@@ -100,11 +100,11 @@
before do
allow(subject.cache).to receive(:branches).and_return ['master', 'invalid-branch']
end
it "only creates an environment for valid branches" do
- expect(subject.generate_environments).to have(1).items
+ expect(subject.generate_environments.size).to eq(1)
end
end
end
# Since prefixing is an immutable property of a source, it's easier to create
@@ -128,10 +128,10 @@
end
let(:environments) { subject.environments }
it "creates an environment for each branch" do
- expect(subject.environments).to have(2).items
+ expect(subject.environments.size).to eq(2)
end
it "prefixes the source name to environments when prefixing is enabled" do
expect(environments[0].dirname).to eq 'prefixed_master'
expect(environments[1].dirname).to eq 'prefixed_other'