Sha256: d21b0b9aa1d9ae96fa5fd1ab8f049f8d612df2afa583742cd339f8f5203986a4

Contents?: true

Size: 961 Bytes

Versions: 7

Compression:

Stored size: 961 Bytes

Contents

describe Vnstat::Result::Month do
  it 'includes Comparable' do
    expect(described_class).to include Comparable
  end

  describe '.extract_from_xml_element' do
    let :element do
      data = <<-XML
        <month id="0">
          <date><year>2015</year><month>9</month></date>
          <rx>1000</rx><tx>2000</tx>
        </month>
      XML
      Nokogiri::XML.parse(data).xpath('month')
    end

    subject do
      described_class.extract_from_xml_element(element)
    end

    it { is_expected.to be_a described_class }

    it 'initializes with the correct #year' do
      expect(subject.year).to eq 2015
    end

    it 'initializes with the correct #month' do
      expect(subject.month).to eq 9
    end

    it 'initializes with the correct #bytes_received' do
      expect(subject.bytes_received).to eq 1000 * 1024
    end

    it 'initializes with the correct #bytes_sent' do
      expect(subject.bytes_sent).to eq 2000 * 1024
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
vnstat-ruby-1.1.0 spec/lib/vnstat/result/month_spec.rb
vnstat-ruby-1.0.5 spec/lib/vnstat/result/month_spec.rb
vnstat-ruby-1.0.4 spec/lib/vnstat/result/month_spec.rb
vnstat-ruby-1.0.3 spec/lib/vnstat/result/month_spec.rb
vnstat-ruby-1.0.2 spec/lib/vnstat/result/month_spec.rb
vnstat-ruby-1.0.1 spec/lib/vnstat/result/month_spec.rb
vnstat-ruby-1.0.0 spec/lib/vnstat/result/month_spec.rb