spec/lib/registry_spec.rb in hieracles-0.3.3 vs spec/lib/registry_spec.rb in hieracles-0.3.4
- old
+ new
@@ -1,33 +1,27 @@
require 'spec_helper'
describe Hieracles::Registry do
let(:base) { File.expand_path('../../../', __FILE__)}
+ let(:options) do
+ {
+ config: 'spec/files/config.yml',
+ basepath: 'spec/files'
+ }
+ end
describe '.farms' do
- let(:options) do
- {
- config: 'spec/files/config.yml',
- basepath: 'spec/files'
- }
- end
let(:config) { Hieracles::Config.new options }
let(:expected) { [
'dev',
'dev2',
'dev4'
] }
it { expect(Hieracles::Registry.farms config).to eq expected }
end
describe '.nodes' do
- let(:options) do
- {
- config: 'spec/files/config.yml',
- basepath: 'spec/files'
- }
- end
let(:expected) { [
'server.example.com',
'server2.example.com',
'server3.example.com',
'server4.example.com'
@@ -35,16 +29,10 @@
let(:config) { Hieracles::Config.new options }
it { expect(Hieracles::Registry.nodes config).to eq expected }
end
describe '.modules' do
- let(:options) do
- {
- config: 'spec/files/config.yml',
- basepath: 'spec/files'
- }
- end
let(:expected) { [
'fake_module',
'fake_module2',
'fake_module3',
'faux_module1',
@@ -53,16 +41,10 @@
let(:config) { Hieracles::Config.new options }
it { expect(Hieracles::Registry.modules config).to eq expected }
end
describe '.nodes_data' do
- let(:options) do
- {
- config: 'spec/files/config.yml',
- basepath: 'spec/files'
- }
- end
let(:expected) {
{
'server.example.com' => {
'country' => 'fr',
'datacenter' => 'equinix',
@@ -86,7 +68,20 @@
}
}
let(:config) { Hieracles::Config.new options }
it { expect(Hieracles::Registry.nodes_data config).to eq expected }
end
+
+ describe '.farms_counted' do
+ let(:expected) {
+ {
+ 'dev' => 1,
+ 'dev2' => 2,
+ 'dev4' => 0
+ }
+ }
+ let(:config) { Hieracles::Config.new options }
+ it { expect(Hieracles::Registry.farms_counted config).to eq expected }
+ end
+
end