Sha256: 22104555a16e636f56e2c7ffa331f16ce3c650b8440a2cda14aa92ee56f18034

Contents?: true

Size: 741 Bytes

Versions: 4

Compression:

Stored size: 741 Bytes

Contents

shared_examples "an element that can respond to change" do
  describe "when passing a block to the constructor" do
    it "should notify the block of change events" do
      expect(input_block).to receive(:call).with(subject)
      subject.call_change_listeners
    end
  end

  describe "when setting up a callback with #change" do
    it "should notify the callback of change events" do
      called = false
      subject.change do
        called = true
      end
      subject.call_change_listeners
      expect(called).to be_truthy
    end

    it "should pass the element itself to the callback" do
      subject.change do |element|
        expect(element).to eq(subject)
      end
      subject.call_change_listeners
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shoes-core-4.0.0.pre7 spec/shoes/shared_examples/changeable.rb
shoes-core-4.0.0.pre6 spec/shoes/shared_examples/changeable.rb
shoes-core-4.0.0.pre5 spec/shoes/shared_examples/changeable.rb
shoes-core-4.0.0.pre4 spec/shoes/shared_examples/changeable.rb