Skip to content

Instantly share code, notes, and snippets.

@svs
Created July 13, 2012 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save svs/3105262 to your computer and use it in GitHub Desktop.
Save svs/3105262 to your computer and use it in GitHub Desktop.
omg spec!
it "should move properly between states" do
@doc = Factory.build(:taggable, :user => @customer)
@doc.scan!(@customer)
@doc.scanned?.should == true
@doc.digi_document_state_transitions.count.should == 1
expect { @doc.tag_complete!}.should raise_exception # should not 'complete'
@doc.completed?.should == false
@doc.to_edit!(@customer) # should 'edit'
@doc.editing?.should == true
@doc.digi_document_state_transitions.count.should == 2
@doc.digi_document_state_transitions.last.event.should == "to_edit"
@doc.state.should == "editing"
@doc.tag_complete!(@tagger)
@doc.completed?.should == true # should 'complete'
@doc.state.should == "completed"
@doc = Factory.build(:taggable, :user => @customer) # new test
expect {@doc.tag_incomplete!(@customer)}.should raise_exception # should not tag_*
@doc.incomplete?.should == false
expect {@doc.checker_accept!}.should raise_exception # should not checker_accept
@doc.checker_accepted?.should == false
expect {@doc.checker_reject!}.should raise_exception
@doc = Factory.build(:taggable, :user => @customer)
@doc.scan!(@customer) # should scan
@doc.scanned?.should == true
expect {@doc.tag_illegible!(@customer)}.should raise_exception # should not tag_*
@doc.illegible?.should == false
@doc.to_edit!(@customer) # should edit
@doc.editing?.should == true
@doc.tag_illegible!(@customer) # should tag_*
@doc.illegible?.should == true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment