Sha256: 310a5d5b1911769dee1a339b2fc4ce47e3046bb35b1aead8463ddb73c2492f99
Contents?: true
Size: 1.2 KB
Versions: 1
Compression:
Stored size: 1.2 KB
Contents
# encoding: utf-8 describe ServiceObjects::Listener do subject { described_class.new double } it "is a simple delegator" do expect(subject).to be_kind_of SimpleDelegator end describe "#otherwise" do it "is defined" do expect(subject).to respond_to :otherwise end end # #otherwise describe "#finalize" do before do subject.__getobj__.singleton_class.send(:define_method, :item) { nil } subject.singleton_class.send(:define_method, :on_success) { nil } subject.singleton_class.send(:define_method, :otherwise) { nil } end it "calls #otherwise when no other methods has been checked" do expect(subject).to receive(:otherwise) subject.finalize end it "calls #otherwise when undefined method has been checked" do expect(subject).to receive(:otherwise) subject.respond_to? :on_error subject.finalize end it "doesn't call #otherwise when defined method has been checked" do expect(subject).not_to receive(:otherwise) subject.respond_to? :on_success subject.finalize end it "returns self" do expect(subject.finalize).to eq subject end end # #finalize end # ServiceObjects::Listener
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
service_objects-0.0.1 | spec/tests/listener_spec.rb |