Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c16e63d727
Fetching contributors…

Cannot retrieve contributors at this time

file 27 lines (22 sloc) 0.76 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
require 'spec_helper'

class ParseTester
  include Munin::Parser
end

describe Munin::Parser do
  before :each do
    @parser = ParseTester.new
  end
  
  it 'parses version request' do
    @parser.parse_version(fixture('version.txt')).should == '1.4.4'
    
    proc { @parser.parse_version("some other response") }.
      should raise_error Munin::InvalidResponse, "Invalid version response"
  end
  
  it 'parses config request' do
    c = @parser.parse_config(fixture('config.txt').strip.split("\n"))
    c.should be_a Hash
    c['graph'].should be_a Hash
    c['graph']['args']['raw'].should == '--base 1024 -l 0 --upper-limit 16175665152'
    c['graph']['args']['parsed'].keys.should == %w(base l upper-limit)
    c['metrics'].should be_a Hash
  end
end
Something went wrong with that request. Please try again.