spec/page_models/base_spec.rb in pagemodels-0.2.0 vs spec/page_models/base_spec.rb in pagemodels-0.2.1
- old
+ new
@@ -98,6 +98,24 @@
@page_model.should_receive(:verify!)
@page_model.open!
end
end
end
+
+ describe "lifecycle hooks" do
+ it "calls hooks before and after _verify" do
+ TestPageModel.after_verify :do_something
+ TestPageModel.after_verify :do_something_else
+ @page_model.should_receive :do_something
+ @page_model.should_receive :do_something_else
+
+ @page_model._verify!
+
+ TestPageModel.before_verify :do_something
+ TestPageModel.before_verify :do_something_else
+ @page_model.should_receive(:do_something).twice
+ @page_model.should_receive(:do_something_else).twice
+
+ @page_model._verify!
+ end
+ end
end
\ No newline at end of file