spec/more/observable_spec.rb in ruby_ext-0.5.9 vs spec/more/observable_spec.rb in ruby_ext-0.5.10
- old
+ new
@@ -1,41 +1,17 @@
-require "more/spec_helper"
+require "spec_helper"
describe "Observable" do
- class AnObservable
- include RubyExt::Observable
- end
+ after{remove_constants :Tmp}
- it "Method without Parameters" do
- mock = mock("Observer")
- obs = AnObservable.new
+ it "method without parameters" do
+ class Tmp
+ include RubyExt::Observable
+ end
+
+ mock = mock "Observer"
+ obs = Tmp.new
obs.add_observer mock
- mock.should_receive(:update).with(2)
+ 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: -> {|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: -> {|o| o == 2}){|o| mock.got o}
- # mock.should_receive(:got).with(2)
- # obs.notify_observers 2
- # obs.notify_observers 4
- # end
end
\ No newline at end of file