Sha256: a3a0eff688cd5e60cc43e10f40aa9c212bb3d403412aadcdbdde990c0b8da9e3

Contents?: true

Size: 1.78 KB

Versions: 10

Compression:

Stored size: 1.78 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
      # 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 { described.to(entity, _name, y, x) }

      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

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

  end # Reposition

end # Vedeu

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
vedeu-0.5.0 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.65 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.64 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.63 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.62 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.61 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.60 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.59 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.58 test/lib/vedeu/cursor/reposition_test.rb
vedeu-0.4.57 test/lib/vedeu/cursor/reposition_test.rb