Sha256: cb6942ff8ee013af2aa222fe33a64935b878f54c9d5a6d9dd1cd53510a867cf9

Contents?: true

Size: 1.76 KB

Versions: 15

Compression:

Stored size: 1.76 KB

Contents

require 'test_helper'

module Vedeu

  describe Reposition do

    let(:described) { Vedeu::Reposition }
    let(:instance)  { described.new(entity, _name, y, x) }
    let(:entity)    { Vedeu::Cursor }
    let(:_name)     { 'reposition' }
    let(:x)         { 4 }
    let(:y)         { 7 }

    before do
      Vedeu::Cursor.new(name: _name, x: 1, y: 1, ox: 1, oy: 1)
      Vedeu.stubs(:trigger)
    end

    after { Vedeu.cursors.reset }

    describe '#initialize' do
      it { instance.must_be_instance_of(Vedeu::Reposition) }
      it { instance.instance_variable_get('@entity').must_equal(entity) }
      it { instance.instance_variable_get('@name').must_equal(_name) }
      it { instance.instance_variable_get('@x').must_equal(x) }
      it { instance.instance_variable_get('@y').must_equal(y) }
    end

    describe '.to' do
      it { described.must_respond_to(:to) }
    end

    describe '#to' do
      # let(:new_entity) { Vedeu::Cursor.new(name: _name, y: 8, x: 5, oy: 7, ox: 4) }

      # before do
      #   entity.stubs(:new).returns(new_entity)
      # end

      subject { instance.to }

      it { subject.must_be_instance_of(entity) }

      # it 'creates and stores a new entity' do
      #   entity.expects(:new).
      #     with(name: _name, y: 8, x: 5, oy: 7, ox: 4)

      #   subject
      # end

      # it 'refreshes the named interface to reflect the new position' do
      #   Vedeu.expects(:trigger).with(:_clear_, _name)
      #   Vedeu.expects(:trigger).with(:_refresh_, _name)
      #   Vedeu.expects(:trigger).with(:_refresh_cursor_, _name)

      #   subject
      # end

      it { subject.x.must_equal(5) }
      it { subject.y.must_equal(8) }
      it { subject.ox.must_equal(4) }
      it { subject.oy.must_equal(7) }
    end

  end # Reposition

end # Vedeu

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
vedeu-0.4.56 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.55 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.54 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.53 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.52 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.51 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.50 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.49 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.48 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.47 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.46 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.45 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.44 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.43 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.42 test/lib/vedeu/cursor/reposition_test.rb