Hi all, I am newbie AASM. I just tried to use AASM on my project. I have a problem: at Model
class Job include AASM aasm :no_direct_assignment => true do state :sleeping, :initial => true state :running state :cleaning event :run do transitions :from => :sleeping, :to => :running end event :clean do transitions :from => :running, :to => :cleaning end event :sleep do transitions :from => [:running, :cleaning], :to => :sleeping end end end And on rspec unit test ... describe '#clean!' do before do AASM::Configuration.stub(:no_direct_assignment).and_return(false) end describe 'Job clearning cancel' do let(:job) { FactoryGirl.create(:job, aasm_status: 'running') } context "when status is 'running'" do it "should update to cleaning" do job.clean! job.reload job.aasm_status.should eql 'cleaning' end end end end ... When i run rspec i got error: Failure/Error: let(:job) { FactoryGirl.create(:job, aasm_status: 'running') } AASM::NoDirectAssignmentError: direct assignment of AASM column has been disabled (see AASM configuration for this class) Please share me any idea to make pass unit test. How can i stub :no_direct_assignment right? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/ab1d86e811ad0df5bf32a7dbc1582089%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.