Open ezilocchi opened 11 years ago
This is an issue I've seen with Devise as well. Any ideas or PRs would be very much appreciated!
On Jun 18, 2013, at 2:10 PM, Emiliano Zilocchi notifications@github.com wrote:
I'm using jasmine-rails-0.4.5 and devise-2.2.3 in a standard rails-3.2 app. When I run bundle exec rake spec:javascript, in order to run the jasmine specs, I'm getting the following message: "Jasmine runner at '/specs' returned a 302 error: Found"
Since I'm using devise any request against the server that is not authenticated yet, it's being redirected to the log-in page. So far so good, that is the expected behavior from devise, but jasmine-rails need to access the /specs url in order to run the tests, so when it tries to access this it, it's getting this error: "Jasmine runner at '/specs' returned a 302 error: Found"
In my routes.rb file I added this line: "mount JasmineRails::Engine => "/my_specs" if defined?(JasmineRails)"
— Reply to this email directly or view it on GitHub.
Ran into the same issue. Was able to get around it by mounting the route above the Devise scope
Kudos @pathouse. I'll leave this open in case a Devise expert wants to grace us with whatever wisdom I lack.
What I currently do, is simply adding a skip_before_filter
to the JasmineRails::SpecRunnerController
In config/application.rb
module MyApp
class Application < Rails::Application
# rest of the stuff here
config.to_prepare do
JasmineRails::SpecRunnerController.skip_before_filter :authenticate_user!
end
end
end
One option to make this unnecessary is to add the line skip_before_filter :authenticate_user!
to the SpecRunnerController
so the authentication is always skipped.
Clever! I imagine that we'd want to do that conditionally (if it exists) and only if that's the standard name of the filter?
On Jul 21, 2013, at 9:42 AM, Andreas Arnold notifications@github.com wrote:
What I currently do, is simply adding a skip_before_filter to the JasmineRails::SpecRunnerController
In config/application.rb
module MyApp class Application < Rails::Application
rest of the stuff here
config.to_prepare do JasmineRails::SpecRunnerController.skip_before_filter :authenticate_user! end
end end One option to make this unnecessary is to add the line skip_before_filter :authenticate_user! to the SpecRunnerController so the authentication is always skipped.
\ Reply to this email directly or view it on GitHub.
Thinking about it a bit more, I realize this shouldn't even be necessary. SpecRunnerController
inherits from JasmineRails::ApplicationController
, so shouldn't even get the authentication filter in the first place.
I'm running into this as well; @featureenvy's solution hasn't worked for me. Digging for one...
I am having this issue and I am not using Devise at all. In face I have no form of redirection, it's mostly an empty rails project. Any help?
Could you provide the project as an example? We can't help without replicating your issue
On Thu, Sep 4, 2014 at 4:52 PM, Don notifications@github.com wrote:
I am having this issue and I am not using Devise at all. In face I have no form of redirection, it's mostly an empty rails project. Any help?
Reply to this email directly or view it on GitHub: https://github.com/searls/jasmine-rails/issues/46#issuecomment-54543070
I found a solution... I yonked the jem and used this one instead:
https://github.com/pivotal/jasmine-gem
Pivotal rocks and that gem worked right out of the box.
Ok
On Thu, Sep 4, 2014 at 4:58 PM, Don notifications@github.com wrote:
I found a solution... I yonked the jem and used this one instead: https://github.com/pivotal/jasmine-gem
Pivotal rocks and that gem worked right out of the box.
Reply to this email directly or view it on GitHub: https://github.com/searls/jasmine-rails/issues/46#issuecomment-54543926
I'm using jasmine-rails-0.4.5 and devise-2.2.3 in a standard rails-3.2 app. When I run bundle exec rake spec:javascript, in order to run the jasmine specs, I'm getting the following message: "Jasmine runner at '/specs' returned a 302 error: Found"
Since I'm using devise any request against the server that is not authenticated yet, it's being redirected to the log-in page. So far so good, that is the expected behavior from devise, but jasmine-rails need to access the /specs url in order to run the tests, so when it tries to access this it, it's getting this error: "Jasmine runner at '/specs' returned a 302 error: Found"
In my routes.rb file I added this line: "mount JasmineRails::Engine => "/my_specs" if defined?(JasmineRails)"