test/lib/vedeu/repositories/repository_test.rb in vedeu-0.4.26 vs test/lib/vedeu/repositories/repository_test.rb in vedeu-0.4.27

- old
+ new

@@ -58,9 +58,43 @@ it { instance.must_be_instance_of(described) } it { instance.instance_variable_get('@model').must_equal(model) } it { instance.instance_variable_get('@storage').must_equal(storage) } end + describe '#all' do + subject { instance.all } + + context 'when there are no models stored in the repository' do + before { instance.reset } + + it { subject.must_equal([]) } + end + + context 'when there are models stored in the repository' do + context 'when the repository is a glorified Hash' do + let(:storage) { + { + oxygen: :life, + plutonium: :death, + } + } + it { subject.must_equal([:life, :death]) } + end + + context 'when the repository is a glorified Set' do + let(:storage) { Set[:oxygen, :hydrogen] } + + it { subject.must_equal([:oxygen, :hydrogen]) } + end + + context 'when the repository is unknown' do + let(:storage) { [:hydrogen, :helium] } + + it { subject.must_equal([:hydrogen, :helium]) } + end + end + end + describe '#current' do subject { instance.current } # it { subject.must_equal('') } end