Sha256: 898ca56a892c1c1e2e599d4fdecd90c9a624234645ab948c1d7100b8b17486ee

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

require File.expand_path('../fixtures/classes', __FILE__)

describe "Observer#notify_observers" do

  before(:each) do
    @observable = ObservableSpecs.new
    @observer = ObserverCallbackSpecs.new
    @observable.add_observer(@observer)
  end

  it "must call changed before notifying observers" do
    @observer.value.should == nil
    @observable.notify_observers("test")
    @observer.value.should == nil
  end

  it "verifies observer responds to update" do
    lambda {
      @observable.add_observer(@observable)
    }.should raise_error(NoMethodError)
  end

  it "receives the callback" do
    @observer.value.should == nil
    @observable.changed
    @observable.notify_observers("test")
    @observer.value.should == "test"
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubysl-observer-1.0.0 spec/notify_observers_spec.rb
rubysl-observer-2.0.0 spec/notify_observers_spec.rb