On Sep 3, 1:20 am, brianp <[email protected]> wrote:
> Hey everyone thanks for the input.
>
> I've tried your suggestions with varying results:
>
> def test_should_delete_word
>     assert_equal 'published', words(:one).status
>     debugger
>     delete :destroy, :id => words(:one).to_param
>     Word.reload
>     word_status=Word.find(:id).status
>     assert_equal 'deleted', word_status
> end
>  Returns reload is not method.
>

reload is a method on an individual activerecord object (ie words
(:one).reload)

Fred

> I tried
> def test_should_delete_word2
>       assert_equal 'published', words(:one).status
>       delete :destroy, :id => words(:one).to_param
>
>       assert_equal 'deleted', Word.find(:id.to_param).status
>   end
> It claims "Couldn't find Word with ID=id" same with assert_equal
> 'deleted', Word.find(:id).status
>
> I also tried using Machinist but really don't know what objects to
> call on to try anything. Wouldn't I have to first create a word then
> find the word delete the ford and check the value. At that point it
> sounds more like an integration test then Functional.
>   def test_should_delete_word
>     word = Word.plan
>     delete :destroy, :id => word.id // Returns cannot find id as the
> object was never stored?
>     assert_equal 'deleted', assigns(:id).status
>   end
>
> Thanks for your suggestions so far
>
> On Sep 1, 10:20 pm, Nik Cool <[email protected]> wrote:
>
>
>
> > def test_should_delete_word
> >     assert_equal 'published', words(:one).status
> >     debugger
> >     delete :destroy, :id => words(:one).to_param
> >     Word.reload
> >     word_status=Word.find(:id).status
> >     assert_equal 'deleted', word_status
> > end
>
> > --
> > nik
>
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to