Sha256: 8562bbfa7b310862bc6cdefc5414936fdc5721feececcb5bdb20b472d721b87a

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 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
      input_block.should_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 |element|
        called = true
      end
      subject.call_change_listeners
      called.should be_true
    end

    it "should pass the element itself to the callback" do
      subject.change do |element|
        element.should == subject
      end
      subject.call_change_listeners
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 spec/shoes/shared_examples/changeable.rb