Sha256: c6b41219c97994026b4ac99b59a4b68bb405202bf1396c8ec4673a573d1e630b

Contents?: true

Size: 990 Bytes

Versions: 7

Compression:

Stored size: 990 Bytes

Contents

require 'spec_helper'

describe Bullet, focused: true do
  subject { Bullet }

  describe '#enable' do

    context 'enable Bullet' do
      before do
        # Bullet.enable
        # Do nothing. Bullet has already been enabled for the whole test suite.
      end

      it 'should be enabled' do
        expect(subject).to be_enable
      end

      context 'disable Bullet' do
        before do
          Bullet.enable = false
        end

        it 'should be disabled' do
          expect(subject).to_not be_enable
        end

        context 'enable Bullet again without patching again the orms' do
          before do
            Bullet::Mongoid.should_not_receive(:enable) if defined? Bullet::Mongoid
            Bullet::ActiveRecord.should_not_receive(:enable) if defined? Bullet::ActiveRecord
            Bullet.enable = true
          end

          it 'should be enabled again' do
            expect(subject).to be_enable
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
bullet_instructure-4.0.5 spec/bullet_spec.rb
bullet_instructure-4.0.3 spec/bullet_spec.rb
bullet_instructure-4.0.2 spec/bullet_spec.rb
bullet-4.11.2 spec/bullet_spec.rb
bullet-4.11.1 spec/bullet_spec.rb
bullet-4.11.0 spec/bullet_spec.rb
bullet-4.10.0 spec/bullet_spec.rb