Sha256: 1d6e3a8b50282a6799ba76b7306a98af9d16d830139e4b565086e0f01736b035

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

require 'RubyExt/require_base'
require 'spec'

module RubyExt
		describe "Observable" do
			class AnObservable
				include Observable
			end
			
			it "Method without Parameters" do
				mock = mock("Observer")
				obs = AnObservable.new
				obs.add_observer mock
				mock.should_receive(:update).with(2)
				obs.notify_observers :update, 2			
			end
			
#			it "Method without Parameters" do
#				mock = mock("Observer")
#				obs = AnObservable.new
#				obs.add_observer(mock, :method => :custom_update, :filter => lambda{|o| o == 2})
#				mock.should_receive(:custom_update).with(2)
#				obs.notify_observers 2
#				obs.notify_observers 4
#			end
#			
#			it "With Block" do
#				mock = mock("Observer")
#				mock.should_receive(:got)
#				obs = AnObservable.new
#				obs.add_observer{mock.got}
#				obs.notify_observers
#			end
#			
#			it "With Block and Filter" do
#				mock = mock("Observer")
#				obs = AnObservable.new
#				obs.add_observer(:filter => lambda{|o| o == 2}){|o| mock.got o}
#				mock.should_receive(:got).with(2)
#				obs.notify_observers 2
#				obs.notify_observers 4									
#			end
		end
end

Version data entries

15 entries across 15 versions & 2 rubygems

Version Path
ruby-ext-0.2.16 old/spec/observable_spec.rb
ruby-ext-0.2.15 old/spec/observable_spec.rb
ruby-ext-0.2.13 old/spec/observable_spec.rb
ruby-ext-0.2.12 old/spec/observable_spec.rb
ruby-ext-0.2.11 old/spec/observable_spec.rb
ruby-ext-0.2.10 old/spec/observable_spec.rb
ruby-ext-0.2.9 old/spec/observable_spec.rb
ruby-ext-0.2.8 old/spec/observable_spec.rb
ruby-ext-0.2.7 old/spec/observable_spec.rb
ruby-ext-0.2.6 old/spec/observable_spec.rb
ruby-ext-0.2.5 old/spec/observable_spec.rb
ruby-ext-0.2.4 old/spec/observable_spec.rb
ruby-ext-0.2.3 old/spec/observable_spec.rb
RubyExt-0.1.1 spec/observable_spec.rb
RubyExt-0.1.2 spec/observable_spec.rb