I have found the problem. I had put fixtures in

test/fixtures/admin/...

And that was causing rails tests to think my table was 
`admin_post_categories`. As soon as I moved the fixture files back to

test/fixtures/...

All the tests just started working again.



On Thursday, June 30, 2016 at 8:12:20 AM UTC-3, Fernando Basso wrote:
>
> I have
>
> app/controllers/admin/post_categories_controller.rb
> app/models/post_category
> app/test/controllers/admin/post_categories_controller_test.rb
>
> When I run
>
> rake test app/test/controllers/admin/post_categories_controller.rb`
>
>
> I get errors like:
>
>   1) Error:
> PostCategoryTest#test_should_not_save_post_category_without_title:
> ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR:  relation 
> "admin_post_categories" does not exist
> LINE 1: DELETE FROM "admin_post_categories"
>
> Here's part of my `post_categories_controller_test.rb`:
>
> require 'test_helper'
>
> class Admin::PostCategoriesControllerTest < ActionController::TestCase
>   setup do
>     @post_category = post_categories(:one)
>   end
>
>   test "should get index" do
>     get :index
>     assert_response :success
>     assert_not_nil assigns(:post_categories)
>   end
>
>   test "should get new" do
>     get :new
>     assert_response :success
>   end
>
> So, basically my problem is that controllers, views and other things are 
> namespaced (for now there is an "admin" namespace, but I will also add a 
> "public" namespace later), but I want to use the same models (not 
> namespaced models) for both the admin and the public area of this system.
>
> Thanks in advance for any help.
>

-- 
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/0a3ba954-0f15-4a12-9004-8658bad08e86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to