spec/chargify/loops_spec.rb in chargify-loops-0.2.0 vs spec/chargify/loops_spec.rb in chargify-loops-0.3.0
- old
+ new
@@ -20,17 +20,36 @@
end
it "does not complain if there's no loops for a given hook" do
Chargify::Loops.delegate_hook :alpha, :foo
end
+
+ it "calls :all loops for all hooks" do
+ Chargify::Loops.loops[:all] = [alpha_hook, beta_hook]
+
+ alpha_hook.should_receive(:call).with(:alpha, :foo)
+ beta_hook.should_receive(:call).with(:alpha, :foo)
+
+ Chargify::Loops.delegate_hook :alpha, :foo
+ end
end
describe '.loop!' do
it "appends a loop for the given event" do
Chargify::Loops.loop! :test do |payload|
#
end
Chargify::Loops.loops[:test].length.should == 1
+ end
+
+ it "appends loops for an array of events" do
+ Chargify::Loops.loop! [:test, :one, :two] do |payload|
+ #
+ end
+
+ Chargify::Loops.loops[:test].length.should == 1
+ Chargify::Loops.loops[:one].length.should == 1
+ Chargify::Loops.loops[:two].length.should == 1
end
end
end