Sha256: 0612cc4f79efb2c8b6f92f47e9a01f447d1bd0b558181b03639e57518432d9c6

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'spec_helper'

describe SpeedGun do
  subject { described_class }

  describe '#config' do
    subject { described_class.config }

    it { should be_kind_of(SpeedGun::Config) }
  end

  describe '#current_profile' do
    let(:profile) { double }
    subject(:current_profile) { described_class.current_profile }

    it 'defaults to be nil' do
      expect(current_profile).to be_nil
    end

    it 'thread localy' do
      described_class.current_profile = profile
      expect(current_profile).to eq(profile)

      thread = Thread.new { expect(described_class.current_profile).to be_nil }
      thread.join
    end
  end

  describe '#discard_profile!' do
    let(:profile) { double }

    it 'discards current profile' do
      described_class.current_profile = profile
      described_class.discard_profile!
      expect(described_class.current_profile).to be_nil
    end
  end

  describe '#enabled?' do
    context 'when enabled' do
      before { described_class.config.stub(enabled?: true) }

      it { should be_enabled }
    end

    context 'when disabled' do
      before { described_class.config.stub(enabled?: false) }

      it { should_not be_enabled }
    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_spec.rb