Sha256: 34b80706dfb124688cdba9c68f6d50779f80a03a718c28aaec4bef6f8b58fb08
Contents?: true
Size: 1.61 KB
Versions: 5
Compression:
Stored size: 1.61 KB
Contents
require "spec_helper" require "baton/observer" describe "Baton::Observer module" do let(:my_observer) { class MyObserver include Baton::Observer def attributes {name: "my_observer_name"} end end MyObserver.new } describe "#notify_error" do context "given an error message" do it "should notify the observers about it" do my_observer.should_receive(:notify_observers).with( {:name=>"my_observer_name", :type=>"error", :error_class=>Exception, :error_message=>"an error"}) my_observer.notify_error(Exception, "an error") end end end describe "#notify_info" do context "given an info message" do it "should notify the observers about it" do my_observer.should_receive(:notify_observers).with( {:name=>"my_observer_name", :type=>"info", :message=>"a message"}) my_observer.notify_info("a message") end end end describe "#notify_success" do context "given a success message" do it "should notify the observers about it" do my_observer.should_receive(:notify_observers).with( {:name=>"my_observer_name", :type=>"success", :message=>"a success message"}) my_observer.notify_success("a success message") end end end describe "#notify_log" do context "given a set or attributes" do it "should notify the observers with those attributes" do my_observer.should_receive(:notify_observers).with( {:name=>"my_observer_name", :attr_1=>1, :attr_2=>2}) my_observer.notify_log({attr_1: 1, attr_2: 2}) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems