November 2010
1 post
Fun state_machine rspec gotcha
Let’s say you’ve got the following: class Thing :draft do event :publish do transition all => :published end state :published do validates_presence_of :author end end end You want to test your validations on the state transition like so: it "requires an author to transition to published" do thing = Thing.new thing.author.should be_nil ...
Nov 20th