Ruby on Rails Friday, April 5, 2013

On Fri, Apr 5, 2013 at 9:38 AM, Dmitrij B. <lists@ruby-forum.com> wrote:

test work without errors. I easy ask, its correct code for this test?

test  "update_shipping_date" do
      order_before = orders(:one)

      get "/orders/1/edit"
      assert_response :success
      assert_template "edit"

      post_via_redirect "/orders",
                                order: { name: "Name",
                                address: "MyText",
                                email: "mail@gmail.com",
                                pay_type_id: pay_types(:one).id,
                                ship_date: "2013-04-04" }

      assert_template 'show'
      assert_equal order_before.ship_date, order.ship_date

  end

Turn it into an integration test and use Capybara to fill in the form as if you are actually on the page and the user. 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment