issue #56 - make topology class configure statement optional

This commit is contained in:
Colin Surprenant 2013-05-08 16:55:05 -04:00
parent 2926dc55ff
commit f7da4e1d99
2 changed files with 11 additions and 1 deletions

View File

@ -127,8 +127,14 @@ module RedStorm
self.components << bolt
end
# hook into the class lifecycle "inherited" method to automatically set the
# topology class into the Configuration object.
# this now makes the topology configure block optional.
def self.inherited(subclass)
Configuration.topology_class = subclass
end
def self.configure(name = nil, &configure_block)
Configuration.topology_class = self
@topology_name = name if name
@configure_block = configure_block if block_given?
end

View File

@ -32,6 +32,10 @@ describe RedStorm::SimpleTopology do
Topology1.topology_name.should == "topology1"
end
it "should set topology class in Configuration object" do
class UnconfiguredTopology < RedStorm::SimpleTopology; end
RedStorm::Configuration.topology_class.name.should == "UnconfiguredTopology"
end
describe "interface" do
it "should implement topology proxy" do