spec/purgatory_spec.rb in purgatory-3.0.0 vs spec/purgatory_spec.rb in purgatory-3.1.0
- old
+ new
@@ -235,10 +235,34 @@
it "should fail if you try to approve again" do
@purgatory.approve!(user2).should be_false
end
end
+ context "approving a performable method that returns false" do
+ before do
+ create_method_call_purgatory
+ @purgatory.soul.stub(:rename).and_return(false)
+ end
+
+ it "should store the soul, requester and performable_method" do
+ @purgatory.soul.should == @widget
+ @purgatory.requester.should == user1
+ @purgatory.performable_method[:method].should == :rename
+ @purgatory.performable_method[:args].should == ['bar']
+ end
+
+ it "should fail when performable method returns false" do
+ @purgatory.approve!(user2).should be_false
+ end
+
+ it "it should not be approved" do
+ @purgatory.should be_present
+ @purgatory.should_not be_approved
+ @purgatory.should be_pending
+ end
+ end
+
context "approving object change purgatory with attr_accessor" do
before do
create_object_change_purgatory_with_attr_accessor
@purgatory.approve!(user2)
@item = Item.find(@item.id)
@@ -671,5 +695,6 @@
def create_subclass_of(klass)
Class.new(klass)
end
end
+