Test for checking update attributes

Did a little test, which verifies that the upgrade ship_date field data
matches during the upgrade. Test code below. Can not quite figure out
how and what to pass to get method. The test does not work,error in file
code. -

On 5 April 2013 14:22, Dmitrij B. [email protected] wrote:

Did a little test, which verifies that the upgrade ship_date field data
matches during the upgrade. Test code below. Can not quite figure out
how and what to pass to get method. The test does not work,error in file
code. -

Does it not tell you which line of code generated the error?

Colin

ActionView::Template::Error: undefined method `>’ for nil:NilClass
/home/dima/RubyOnRails/Projects/depot/app/views/layouts/application.html.erb:23:in

On 5 April 2013 14:43, Dmitrij B. [email protected] wrote:

Please quote the previous message so that it is easier to follow the
thread. Remember this is a mailing list not a forum (though you may
be accessing it via a forum like interface). Thanks.

its text error: Error:
test_update_shipping_date(UserStoriesTest):
ActionView::Template::Error: undefined method `>’ for nil:NilClass

/home/dima/RubyOnRails/Projects/depot/app/views/layouts/application.html.erb:23:in

Look at the error, it says you have tried to call the method ‘>’ for
something that is nil. Now look at the line mentioned:
<% if (session[:counter] > 5) %>
It seems likely that session[:counter] is nil.

Have a look at the Rails Guide on debugging, it will show you
techniques that you can use to debug your code.

By the way, if posting again it is better to just copy the relevant
bits of code and put them inline in the message, unless you really
have to post lots of code, which in this case was not necessary.

Colin

thanks))) And what you can say about my test. I wrote corectly his?

On 5 April 2013 15:06, Dmitrij B. [email protected] wrote:

thanks))) And what you can say about my test. I wrote corectly his?

Please read my previous reply again. Especially the last paragraph.

I have not looked at the test. Is it not working? When asking
questions here it is better to try and ask a specific question.

Colin

On Fri, Apr 5, 2013 at 9:38 AM, Dmitrij B. [email protected] wrote:

                            order: { name: "Name",
                            address: "MyText",
                            email: "[email protected]",
                            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.

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: "[email protected]",
                            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

On Fri, Apr 5, 2013 at 9:45 AM, Jordon B. [email protected]
wrote:

On Fri, Apr 5, 2013 at 9:38 AM, Dmitrij B. [email protected] wrote:

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.

I said integration, I meant feature.