Sha256: 3f15fc224b7053c1c5db2a616cd4321fb468b44a0a4dd2d8194aed6cfecbd3a7
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 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 '.initialize' do let(:entity) { :some_model } subject { described_class.new(entity) } it 'assigns the entity to an instance variable' do subject.instance_variable_get('@entity').must_equal(entity) end end 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
troo-0.0.8 | test/lib/troo/models/behaviours/set_default_test.rb |