require 'spec_helper' describe CephStorage::Cluster do let(:config) { cluster_config } let(:cluster) { CephStorage::ClusterFactory.build config } subject { cluster } it 'should respond to rados_cluster' do expect(subject).to respond_to :rados_cluster end it 'should respond to pool' do expect(subject).to respond_to :pool end it 'should respond to open?' do expect(subject).to respond_to :open? end it 'should respond to open' do expect(subject).to respond_to :open end it 'should respond to shutdown' do expect(subject).to respond_to :shutdown end it 'should respond to ensure open' do expect(subject).to respond_to :ensure_open end it 'should be a ::CephRuby::Cluster' do expect(subject).to be_a ::CephRuby::Cluster end describe 'calling build with the same attributes' do let(:second_cluster) { CephStorage::ClusterFactory.build config } it 'should be the same object as subject' do expect(subject).to be(second_cluster) end let(:third_config) { config.clone } before { third_config.delete(:flags) } let(:third_cluster) { CephStorage::ClusterFactory.build third_config } it 'should be the same when changing attribute to equivilent default' do expect(subject).to be(third_cluster) end end describe 'Calling pool' do let(:pool_name) { spec_config[:pool][:name] } let(:pool) { cluster.pool(pool_name) } subject { pool } it 'should be a pool factory' do expect(subject).to be_a CephStorage::Pool end end describe 'Calling inherited functions' do describe 'status' do it 'should not raise exception' do expect { cluster.status }.not_to raise_exception end it 'should return a hash' do expect(cluster.status).to be_a Hash end end end end