test/lib/vedeu/repository/interface_repository_test.rb in vedeu-0.0.21 vs test/lib/vedeu/repository/interface_repository_test.rb in vedeu-0.0.22

- old
+ new

@@ -2,11 +2,11 @@ module Vedeu describe InterfaceRepository do let(:described_class) { InterfaceRepository } - before { Interface.create({ name: 'dummy' }) } + before { InterfaceRepository.create({ name: 'dummy', width: 15, height: 2 }) } after { InterfaceRepository.reset } describe '.find' do let(:subject) { described_class.find(value) } let(:value) { 'dummy' } @@ -39,9 +39,29 @@ describe '.entity' do let(:subject) { described_class.entity } it 'returns an Interface' do subject.must_equal(Interface) + end + end + + describe '.by_layer' do + let(:subject) { described_class.by_layer } + + before do + InterfaceRepository.reset + @case_a = InterfaceRepository.create({ name: 'a', width: 15, height: 2, layer: 1 }) + @case_b = InterfaceRepository.create({ name: 'b', width: 15, height: 2, layer: 0 }) + @case_c = InterfaceRepository.create({ name: 'c', width: 15, height: 2, layer: 2 }) + end + after { InterfaceRepository.reset } + + it 'returns an Array' do + subject.must_be_instance_of(Array) + end + + it 'returns the collection in order they should be drawn' do + subject.must_equal([@case_b, @case_a, @case_c]) end end end end