test/lib/vedeu/geometry/position_index_test.rb in vedeu-0.4.17 vs test/lib/vedeu/geometry/position_index_test.rb in vedeu-0.4.18

- old
+ new

@@ -9,24 +9,12 @@ let(:y) { 6 } let(:x) { 17 } describe '#initialize' do it { instance.must_be_instance_of(described) } - it { instance.instance_variable_get('@y').must_equal(5) } - it { instance.instance_variable_get('@x').must_equal(16) } - - context 'when y is less than 1' do - let(:y) { -3 } - - it { instance.instance_variable_get('@y').must_equal(0) } - end - - context 'when x is less than 1' do - let(:x) { -9 } - - it { instance.instance_variable_get('@x').must_equal(0) } - end + it { instance.instance_variable_get('@y').must_equal(y) } + it { instance.instance_variable_get('@x').must_equal(x) } end describe '.[]' do subject { described[y, x] } @@ -59,24 +47,34 @@ subject { instance.to_position } it { subject.must_be_instance_of(Vedeu::Position) } end - describe 'attr_reader' do - context '#y' do - subject { instance.y } + describe '#y' do + subject { instance.y } - it { subject.must_equal(5) } + it { subject.must_equal(5) } - it { instance.must_respond_to(:first) } + it { instance.must_respond_to(:first) } + + context 'when y is less than 1' do + let(:y) { -3 } + + it { subject.must_equal(0) } end + end - context '#x' do - subject { instance.x } + describe '#x' do + subject { instance.x } - it { subject.must_equal(16) } + it { subject.must_equal(16) } - it { instance.must_respond_to(:last) } + it { instance.must_respond_to(:last) } + + context 'when x is less than 1' do + let(:x) { -9 } + + it { subject.must_equal(0) } end end end # PositionIndex