Sha256: 42a4607b89ba51b36a82c29742bf6c5b2f8735cc3113a844ba854a244b26c390

Contents?: true

Size: 902 Bytes

Versions: 3

Compression:

Stored size: 902 Bytes

Contents

shared_examples "movable element" do |left, top|

  before :each do
    allow(dsl).to receive_messages element_left: left, element_top: top
  end

  context "with disposed real element" do
    before :each do
      allow(real).to receive(:disposed?) { true }
    end

    it "doesn't delegate to real" do
      expect(real).not_to receive(:set_location)
      subject.update_position
    end
  end

  context "with undisposed real element" do
    before :each do
      allow(real).to receive(:disposed?) { false }
    end

    it "delegates to real" do
      expect(real).to receive(:set_location).with(left, top)
      subject.update_position
    end
  end
end

shared_examples_for "movable shape" do |x, y|
  it "redraws container" do
    expect(container).to receive(:redraw).at_least(2).times
    allow(dsl).to receive_messages element_left: x, element_top: y
    subject.update_position
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre4 spec/shoes/swt/shared_examples/movable.rb
shoes-swt-4.0.0.pre3 spec/shoes/swt/shared_examples/movable.rb
shoes-swt-4.0.0.pre2 spec/swt_shoes/shared_examples/movable.rb