mercredi 29 avril 2015

Rails Integration Test

I am taking a Rails class and am stuck on an Integration test. I have made a simple app that a user can use to share a link to a website. I want to create a test that will:

  1. Get the amount of links currently in the database
  2. Post a new link
  3. Check that the number of links has increased by 1.

Here is what I have so far:

test "posts new link and check count" do
   @link = Links.all
   get "/links/new"
   post_via_redirect "/links/new", :url => links(:test_link).url, :description => links(:test_link).description
   assert_equal '/links/new', path
   assert_difference("Link.count",n) do

I know this doesn't work but I cannot figure out the wording/syntax and would really appreciate a nod in the right direction. Please let me know if I should include other information.

Aucun commentaire:

Enregistrer un commentaire