-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to sign_in in CrudTestModelsController specs #15
Comments
I have created a separated branch to reporduce the issue: |
In order to run these test correctly, I disabled the authentication for the abstract controller CrudController and I am including it in each and every sub-controller: class CrudController < ListController
skip_before_action :authenticate_user!
#...
end I noticed that brakeman warns about this security issue generated by the scaffolding:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would like firsty to congratulate for the great job.
I am having some hard time to get the default tests to pass.
In my Gemfile I have:
Requiring Support Files
The first issue I faced to pass the gem auto-generated test was to require automatically all files in support folder by adding to
spec/rails_helper.rb
Authenticate in Controllers specs
Since I am using Devise gem for authentication, the most of controller's specs fail due to authentication issues. My initial setup was:
I firstly tried the usual behavior of Rspec and Devise:
But it seems that
crud_test_models_controller_spec.rb
is acting like an integration test - such as Capybara tests - so I encountered the following issue:So I have added the
@request.env
as followsBased on this StackOverflow answer, I have changed my test as follows:
From the test output I have attached, it seems that it is not logging in properly.
crud_test_models_controller_spec.pdf
I tried then to implement the
login_as
authentication usinginclude Warden::Test::Helpers
without different results.I also tried to downgrade devise gem to 4.1 for a different testhelper suite, but still the same issue.
This is the repository where I am trying to integrate
dry_crud
: https://github.com/mberlanda/cheidelacorieraDo you have any idea of I could I make it work properly?
Thanks
The text was updated successfully, but these errors were encountered: