[Rails] Re: Why does this test fail.

2014-12-08 Thread Roelof Wobben


Op maandag 8 december 2014 12:42:14 UTC+1 schreef Matt Jones:
>
>
>
> On Sunday, 7 December 2014 11:50:57 UTC-6, Roelof Wobben wrote:
>>
>> Hello, 
>>
>> Sorry for the double post but on reddit nobody seems to have the 
>> solution. 
>>
>> im following the agile web developement book but then with my own layout. 
>>
>> Now am at chapter 9 where a shopping card is added. But as soon as I try 
>> to test the card I see this error 
>>
>> LineItemsControllerTest#test_should_create_line_item:
>> RuntimeError: @controller is nil: make sure you set it in your test's 
>> setup method. 
>>
>> my code can be found here : *https://github.com/roelof1967/commerce-try* 
>> 
>>
>> Who can help me figure out why this test is failing. According to the 
>> book it must all be successfull. 
>>
>> Roelof
>>
>
> The file in app/controllers/concerns is not named correctly - it declares 
> a `CurrentCart` module, but is named `current_card.rb`. Fixing that makes 
> all the tests pass.
>
> --Matt Jones 
>

I found it . The problem was in the name. When I change it to 
current_cart.rb it worked fine.

Roelof
 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/920d8aee-2f3d-4632-bb20-7bc3474a6ac0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Why does this test fail.

2014-12-08 Thread Matt Jones


On Sunday, 7 December 2014 11:50:57 UTC-6, Roelof Wobben wrote:
>
> Hello, 
>
> Sorry for the double post but on reddit nobody seems to have the solution. 
>
> im following the agile web developement book but then with my own layout. 
>
> Now am at chapter 9 where a shopping card is added. But as soon as I try 
> to test the card I see this error 
>
> LineItemsControllerTest#test_should_create_line_item:
> RuntimeError: @controller is nil: make sure you set it in your test's 
> setup method. 
>
> my code can be found here : *https://github.com/roelof1967/commerce-try* 
> 
>
> Who can help me figure out why this test is failing. According to the book 
> it must all be successfull. 
>
> Roelof
>

The file in app/controllers/concerns is not named correctly - it declares a 
`CurrentCart` module, but is named `current_card.rb`. Fixing that makes all 
the tests pass.

--Matt Jones 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/aa90b74b-f550-41cd-9056-a77ca944822f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Rails] Re: Why does this test fail.

2014-12-08 Thread André Orvalho
Normally that problem occurs when you have a weird nesting or the naming of 
the controller compared to the test name is not correct as you can see in 
this 2 posts:
http://stackoverflow.com/questions/14267506/keep-getting-controller-is-nil-error
http://stackoverflow.com/questions/7743059/how-do-i-get-rid-of-controller-is-nil-error-in-my-tests

I only use rspec so I am not sure that this:
https://gist.github.com/andreorvalho/b306e186e888b1eccab5 

has the correct syntax. does the test for delete at the end fail too?

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/e60431fb-e51c-4d4d-b742-c9083631efed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.