I've tried handpatching Shoulda 4.0.1, but am still getting the exact
same errors .... it's probably just me, as I am still struggling with
testing.
Here's the error I get for my show action for
Admin::ProductsController
ruby test/functional/admin/products_controller_test.rb
Loaded suite test/functional/admin/products_controller_test
Started
....F.FF
Finished in 0.540747 seconds.
1) Failure:
test: Admin users on GET to :show should assign @product.
(Admin::ProductsControllerTest)
[/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
controller_tests/controller_tests.rb:344
/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
shoulda.rb:190
/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
shoulda.rb:190
test/functional/admin/products_controller_test.rb:14]:
The action isn't assigning to @product.
<nil> is not true.
2) Failure:
test: Admin users on GET to :show should render 'show' template.
(Admin::ProductsControllerTest)
[/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
controller_tests/controller_tests.rb:375
/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
shoulda.rb:190
/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
shoulda.rb:190
test/functional/admin/products_controller_test.rb:14]:
expecting <"show"> but rendering with <"diagnostics.erb">
3) Failure:
test: Admin users on GET to :show should respond with success.
(Admin::ProductsControllerTest)
[/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
controller_tests/controller_tests.rb:365
/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
shoulda.rb:190
/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
shoulda.rb:190
test/functional/admin/products_controller_test.rb:14]:
Expected response to be a <:success>, but was <404>
8 tests, 16 assertions, 3 failures, 0 errors
The fact that I get 404 and diagnostics.erb, tells me that the request
to show is probably going to an undefined route, or is going to the
public routes, which are very different.
For the index action, everything seems to be working just fine.
Now, there's nothing really interesting in the show action:
def show
@product = Product.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @product }
end
end
> I've tried handpatching Shoulda 4.0.1, but am still getting the exact
> same errors .... it's probably just me, as I am still struggling with
> testing.
> Here's the error I get for my show action for
> Admin::ProductsController
> ruby test/functional/admin/products_controller_test.rb
> Loaded suite test/functional/admin/products_controller_test
> Started
> ....F.FF
> Finished in 0.540747 seconds.
> 1) Failure:
> test: Admin users on GET to :show should assign @product.
> (Admin::ProductsControllerTest)
> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> controller_tests/controller_tests.rb:344
> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
> shoulda.rb:190
> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
> shoulda.rb:190
> test/functional/admin/products_controller_test.rb:14]:
> The action isn't assigning to @product.
> <nil> is not true.
> 2) Failure:
> test: Admin users on GET to :show should render 'show' template.
> (Admin::ProductsControllerTest)
> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> controller_tests/controller_tests.rb:375
> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
> shoulda.rb:190
> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
> shoulda.rb:190
> test/functional/admin/products_controller_test.rb:14]:
> expecting <"show"> but rendering with <"diagnostics.erb">
> 3) Failure:
> test: Admin users on GET to :show should respond with success.
> (Admin::ProductsControllerTest)
> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> controller_tests/controller_tests.rb:365
> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
> shoulda.rb:190
> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/gem/
> shoulda.rb:190
> test/functional/admin/products_controller_test.rb:14]:
> Expected response to be a <:success>, but was <404>
> 8 tests, 16 assertions, 3 failures, 0 errors
> The fact that I get 404 and diagnostics.erb, tells me that the request
> to show is probably going to an undefined route, or is going to the
> public routes, which are very different.
> For the index action, everything seems to be working just fine.
> Now, there's nothing really interesting in the show action:
> def show
> @product = Product.find(params[:id])
> respond_to do |format|
> format.html # show.html.erb
> format.xml { render :xml => @product }
> end
> end
> Yeah has anyone figured this out? I cannot test my namespace > controllers.
> On Mar 30, 4:47 am, MRoderick <roderick.mor...@gmail.com> wrote: >> I am having some trouble getting should_be_restful to work for >> namespaced controllers (admin controllers), Shoulda 4.0.1, Rails >> 2.0.2.
>> I've tried handpatching Shoulda 4.0.1, but am still getting the exact >> same errors .... it's probably just me, as I am still struggling with >> testing.
>> Here's the error I get for my show action for >> Admin::ProductsController
>> ruby test/functional/admin/products_controller_test.rb >> Loaded suite test/functional/admin/products_controller_test >> Started >> ....F.FF >> Finished in 0.540747 seconds.
>> 1) Failure: >> test: Admin users on GET to :show should assign @product. >> (Admin::ProductsControllerTest) >> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> controller_tests/controller_tests.rb:344 >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> gem/ >> shoulda.rb:190 >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> gem/ >> shoulda.rb:190 >> test/functional/admin/products_controller_test.rb:14]: >> The action isn't assigning to @product. >> <nil> is not true.
>> 2) Failure: >> test: Admin users on GET to :show should render 'show' template. >> (Admin::ProductsControllerTest) >> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> controller_tests/controller_tests.rb:375 >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> gem/ >> shoulda.rb:190 >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> gem/ >> shoulda.rb:190 >> test/functional/admin/products_controller_test.rb:14]: >> expecting <"show"> but rendering with <"diagnostics.erb">
>> 3) Failure: >> test: Admin users on GET to :show should respond with success. >> (Admin::ProductsControllerTest) >> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> controller_tests/controller_tests.rb:365 >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> gem/ >> shoulda.rb:190 >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/ >> gem/ >> shoulda.rb:190 >> test/functional/admin/products_controller_test.rb:14]: >> Expected response to be a <:success>, but was <404>
>> 8 tests, 16 assertions, 3 failures, 0 errors
>> The fact that I get 404 and diagnostics.erb, tells me that the >> request >> to show is probably going to an undefined route, or is going to the >> public routes, which are very different.
>> For the index action, everything seems to be working just fine.
>> Now, there's nothing really interesting in the show action:
>> def show >> @product = Product.find(params[:id])
>> respond_to do |format| >> format.html # show.html.erb >> format.xml { render :xml => @product } >> end >> end
> What we need is an updated patch which includes tests (the last one
> was for an older version of shoulda).
> Cheers,
> Tammer
> On Apr 2, 2008, at 5:18 PM, jko170 wrote:
> > Yeah has anyone figured this out? I cannot test my namespace
> > controllers.
> > On Mar 30, 4:47 am, MRoderick <roderick.mor...@gmail.com> wrote:
> >> I am having some trouble getting should_be_restful to work for
> >> namespaced controllers (admin controllers), Shoulda 4.0.1, Rails
> >> 2.0.2.
> >> I've tried handpatching Shoulda 4.0.1, but am still getting the exact
> >> same errors .... it's probably just me, as I am still struggling with
> >> testing.
> >> Here's the error I get for my show action for
> >> Admin::ProductsController
> >> ruby test/functional/admin/products_controller_test.rb
> >> Loaded suite test/functional/admin/products_controller_test
> >> Started
> >> ....F.FF
> >> Finished in 0.540747 seconds.
> >> 1) Failure:
> >> test: Admin users on GET to :show should assign @product.
> >> (Admin::ProductsControllerTest)
> >> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> controller_tests/controller_tests.rb:344
> >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> gem/
> >> shoulda.rb:190
> >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> gem/
> >> shoulda.rb:190
> >> test/functional/admin/products_controller_test.rb:14]:
> >> The action isn't assigning to @product.
> >> <nil> is not true.
> >> 2) Failure:
> >> test: Admin users on GET to :show should render 'show' template.
> >> (Admin::ProductsControllerTest)
> >> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> controller_tests/controller_tests.rb:375
> >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> gem/
> >> shoulda.rb:190
> >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> gem/
> >> shoulda.rb:190
> >> test/functional/admin/products_controller_test.rb:14]:
> >> expecting <"show"> but rendering with <"diagnostics.erb">
> >> 3) Failure:
> >> test: Admin users on GET to :show should respond with success.
> >> (Admin::ProductsControllerTest)
> >> [/Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> controller_tests/controller_tests.rb:365
> >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> gem/
> >> shoulda.rb:190
> >> /Users/morgan/mysecretsite/vendor/plugins/shoulda/lib/shoulda/
> >> gem/
> >> shoulda.rb:190
> >> test/functional/admin/products_controller_test.rb:14]:
> >> Expected response to be a <:success>, but was <404>
> >> 8 tests, 16 assertions, 3 failures, 0 errors
> >> The fact that I get 404 and diagnostics.erb, tells me that the
> >> request
> >> to show is probably going to an undefined route, or is going to the
> >> public routes, which are very different.
> >> For the index action, everything seems to be working just fine.
> >> Now, there's nothing really interesting in the show action:
> >> def show
> >> @product = Product.find(params[:id])
> >> respond_to do |format|
> >> format.html # show.html.erb
> >> format.xml { render :xml => @product }
> >> end
> >> end