tôi có các thiết lập sau:RSpec Bộ xử lý trong và ngoài namespace với cùng một tên
class UsersController < ApplicationController
...
end
class Admin::BaseController < ApplicationController
...
end
class Admin::UsersController < Admin::BaseController
...
end
Và tương tự như vậy thông số kỹ thuật:
#spec/controllers/users_controller_spec.rb:
describe UsersController do
...
end
#spec/controllers/admin/users_controller_spec.rb
describe Admin::UsersController do
...
end
Tất cả các thông số kỹ thuật chạy tốt khi chạy independantly, tuy nhiên khi tôi chạy tất cả cùng nhau tôi nhận được cảnh báo:
toplevel constant UsersController referenced by Admin::UsersController
Và thông số kỹ thuật từ bộ điều khiển quản trị không vượt qua.
Tuyến file:
...
resources :users
namespace "admin" do
resources :users
end
...
Rails 4, RSpec 2.14
Tôi có thể không sử dụng cùng tên cho bộ điều khiển trong không gian tên khác nhau?
này hoạt động. Rực rỡ! +1 –