Sha256: 761cf20807b55397b029d6eed89e533f93f3f264c7a5ac4ba84cbbb1c16f7e5c

Contents?: true

Size: 1016 Bytes

Versions: 1

Compression:

Stored size: 1016 Bytes

Contents

require 'spec_helper'

describe Beso do
  subject { Beso }

  describe '#configure' do
    it { should respond_to( :configure ) }

    it 'should yield itself to #configure' do
      subject.configure do |config|
        config.should eql( subject )
      end
    end
  end

  describe '#start_time' do
    before do
      Beso.start_time = nil
    end

    subject { Beso.start_time }

    context 'when not set' do
      it { should eq( 1.hour.ago.to_i ) }
    end

    context 'when ENV["BESO_START_TIME"] is set' do
      around do |example|
        with_const( :BESO_START_TIME, 2.hours.ago.to_i ) do
          example.run
        end
      end

      it { should eq( 2.hours.ago.to_i ) }
    end

    context 'when explicitly set in the config' do
      around do |example|
        with_const( :BESO_START_TIME, 2.hours.ago.to_i ) do
          example.run
        end
      end

      before do
        Beso.start_time = 3.hours.ago.to_i
      end

      it { should eq( 3.hours.ago.to_i ) }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beso-0.0.1 spec/beso/config_spec.rb