Try:
post "/posts/update/#{Post.find(:first).id}"...
On 16 Sty, 16:07, aquabali <[email protected]> wrote:
> For my homework;bullet#1
> -Update the title of the first post
>
> I wrote the integration test as follow
> def test_update_and_create_post
> post=posts(:one)
> post 'posts/update',{:id=>post.id ,:title => 'new title'}
> end
>
> I checked the test.log to see the update was happening as intended.
> -The only thing I could not understand from the log is why do I see a
> Rollback and not commit?
> -Even if it is a rollback ,why don't I see the update
> query updating my title as title='new title' rather leaves it as
> title='my first post' ?
>
> When I ran the test I did get the right message which told me that the
> test clause was written correctly
> 2 tests, 1 assertions, 0 failures, 0 errors
>
> --message from test.log--
> Processing PostsController#update (for 127.0.0.1 at 2009-01-16
> 10:00:19) [POST]
> Session ID: e7fa10b328f1f670f70a048706a2fe05
> Parameters: {"id"=>"11", "title"=>"new title",
> "controller"=>"posts", "action"=>"update"}
> [4;36;1mPost Load (0.003340) [0m [0;1mSELECT * FROM `posts`
> WHERE (`posts`.`id` = 11) [0m
> [4;35;1mPost Update (0.070650) [0m [0mUPDATE `posts` SET `body`
> = 'I will explain why life is good', `created_at` = '2009-01-16
> 10:00:18', `title` = 'my first post', `updated_at` = '2009-01-16
> 10:00:19' WHERE `id` = 11 [0m
> Redirected tohttp://www.example.com/posts/11
> Completed in 0.13286 (7 reqs/sec) | DB: 0.27806 (209%) | 302 Found
> [http://www.example.com/posts/update]
> [4;36;1mSQL (0.061567) [0m [0;1mROLLBACK [0m
>
> Could someone give me a more understanding of how the test should
> function? I have gone through different websites but could not find a
> location that exactly told me what the log information pertains to and
> is henceforth confusing me as to what rails testing is all about. Any
> help is appreciated.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "ruby-on-rails-programming-with-passion" group.
To unsubscribe from this group, send email to
ruby-on-rails-programming-with-passion-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/ruby-on-rails-programming-with-passion?hl=en?hl=en
-~----------~----~----~----~------~----~------~--~---