Sha256: 84cccb254e7af7bd1cbae9d786a516f02021265e732ad9444d35e8352bf89b5c

Contents?: true

Size: 884 Bytes

Versions: 1

Compression:

Stored size: 884 Bytes

Contents

require 'spec_helper'

describe SpeedGun::Profile do
  subject(:profile) { described_class.new }

  describe '#id' do
    subject { profile.id }

    it { should be_kind_of(String) }
  end

  describe '#events' do
    subject { profile.events }

    it { should be_kind_of(Array) }
  end

  describe '#record!' do
    let(:logger) { double(debug: nil) }
    let(:event) { SpeedGun::Event.new('spec.test') }

    before { profile.config.logger = logger }

    it 'records event' do
      expect(profile.record!(event)).to eq(profile.events)
      expect(profile.events).to include(event)
    end
  end

  describe '#to_hash' do
    let(:event) { SpeedGun::Event.new('spec.test') }

    before { profile.record!(event) }

    it 'valid serialize' do
      expect(
        SpeedGun::Profile.from_hash(profile.id, profile.to_hash).to_hash
      ).to eq(profile.to_hash)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
speed_gun-1.0.0.rc1 spec/lib/speed_gun/profile_spec.rb