Sha256: 530d1abddfec7ebbe82569aa62f3d6d4fb54d5690e8bd966d778062e08a5618f

Contents?: true

Size: 1.01 KB

Versions: 51

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Marty::Diagnostic::Collection do
  def sample_data consistent = true
    node_a_data = described_class.pack(include_ip = false) { 'A' }
    data = {
      'NodeA' => node_a_data,
      'NodeB' => node_a_data,
    }
    return data if consistent

    data + { 'NodeB' => { 'Base' => described_class.error('B') } }
  end

  it 'all diagnostics in diagnostics class attribute are generated' do
    diags = [Marty::Diagnostic::Version, Marty::Diagnostic::Nodes]
    expected = diags.map(&:generate).reduce(:deep_merge)
    described_class.diagnostics = diags
    expect(described_class.generate).to eq(expected)
  end

  it 'declares data consistency via status consistency' do
    a = sample_data
    b = sample_data + {
      'NodeB' => described_class.pack(include_ip = false) { 'B' }
    }
    c = sample_data(consistent = false)

    expect(described_class.consistent?(a)).to eq(true)
    expect(described_class.consistent?(b)).to eq(true)
    expect(described_class.consistent?(c)).to eq(false)
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
marty-14.3.0 spec/other/diagnostic/collection_spec.rb
marty-14.0.0 spec/other/diagnostic/collection_spec.rb
marty-13.0.2 spec/other/diagnostic/collection_spec.rb
marty-11.0.0 spec/other/diagnostic/collection_spec.rb
marty-10.0.3 spec/other/diagnostic/collection_spec.rb
marty-10.0.2 spec/other/diagnostic/collection_spec.rb
marty-10.0.0 spec/other/diagnostic/collection_spec.rb
marty-9.5.1 spec/other/diagnostic/collection_spec.rb
marty-9.5.0 spec/other/diagnostic/collection_spec.rb
marty-9.3.3 spec/other/diagnostic/collection_spec.rb
marty-9.3.2 spec/other/diagnostic/collection_spec.rb
marty-9.3.0 spec/other/diagnostic/collection_spec.rb
marty-8.5.0 spec/other/diagnostic/collection_spec.rb
marty-8.4.1 spec/other/diagnostic/collection_spec.rb
marty-8.3.1 spec/other/diagnostic/collection_spec.rb
marty-8.2.0 spec/other/diagnostic/collection_spec.rb
marty-8.0.0 spec/other/diagnostic/collection_spec.rb
marty-6.1.0 spec/other/diagnostic/collection_spec.rb
marty-5.2.0 spec/other/diagnostic/collection_spec.rb
marty-5.1.4 spec/other/diagnostic/collection_spec.rb