I have a custom controller not associated with any engine that I'd
like to test. However without a superuser refinery intercepts all
calls to the controller's routes and redirects to the superuser
creation process.
in /spec/support/refinery/controller_macros.rb there's a method called
login_refinery_user which looks like it could be extended to
login_refinery_superuser but I don't know how to incorporate that
module and the associated factories (i.e. Factory(:refinery_user))
into my own tests.
Yep, and I've copied that into my controller_macros.rb file, however
I'm unclear on how exactly to get that to work with my controller's
spec. If I do the following:
describe WidgetsController do
include Refinery::ControllerMacros
def setup
login_refinery_superuser
...
end
describe '#featured' do
before { setup }
... tests etc...
end
end
It generates an "undefined method `before' for
#<RSpec::Core::ExampleGroup::Nested_1::Nested_1::Nested_1:0x007f990c6996a8> "
error. I'd like to use the Refinery::ControllerMacros in my controller
spec, I'm just not clear about how to integrate them.
On Feb 6, 12:14 pm, Philip Arndt <par...@gmail.com> wrote:
I think it makes for a nice first-time experience, but it does complicate a few things. Maybe add a setting to disable it so that monkeypatches aren't needed? This would also save so DB queries from running on every request.
I think disabling it is a reasonable default to have when the
Rails.env == test. Currently it is not immediately obvious that this
is the issue when running controller test.
Thanks for the work-around Pete, and thanks for the help Philip!
On Feb 6, 1:46 pm, Philip Arndt <par...@gmail.com> wrote: