Sha256: 6210e43765289b05b78c37a437b1923161b8525a407e991dc3b3c64c9eba6d7a

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require_relative '../../../../test_helper'

module Troo
  describe Behaviours::NullEntity do
    let(:described_class) { Behaviours::NullEntity }

    describe '#default?' do
      subject { described_class.new.default? }

      it { subject.must_equal false }
    end
  end

  describe Behaviours::SetDefault do
    let(:described_class) { Behaviours::SetDefault }

    describe '#set_default!' do
      before do
        @board_1 = Fabricate(:board, default: true)
        @board_2 = Fabricate(:board, default: false)
      end

      after { database_cleanup }

      subject { described_class.for(entity) }

      context 'when the entity is already the default' do
        let(:entity) { @board_1 }

        it { subject.must_equal true }
      end

      context 'when the entity is not already the default' do
        let(:entity) { @board_2 }

        it 'sets the specified entity to be the default' do
          subject.default.must_equal(true)

          subject.must_equal(@board_2)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
troo-0.0.12 test/lib/troo/models/behaviours/set_default_test.rb
troo-0.0.11 test/lib/troo/models/behaviours/set_default_test.rb
troo-0.0.10 test/lib/troo/models/behaviours/set_default_test.rb
troo-0.0.9 test/lib/troo/models/behaviours/set_default_test.rb