Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Jasmine runner at '/specs' returned a 302 error: Found #46

Open
ezilocchi opened this issue Jun 18, 2013 · 11 comments
Open

Jasmine runner at '/specs' returned a 302 error: Found #46

ezilocchi opened this issue Jun 18, 2013 · 11 comments

Comments

@ezilocchi
Copy link

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)"

@searls
Copy link
Member

searls commented Jun 18, 2013

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.

@pathouse
Copy link

pathouse commented Jul 9, 2013

Ran into the same issue. Was able to get around it by mounting the route above the Devise scope

@searls
Copy link
Member

searls commented Jul 12, 2013

Kudos @pathouse. I'll leave this open in case a Devise expert wants to grace us with whatever wisdom I lack.

@featureenvy
Copy link

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.

@searls
Copy link
Member

searls commented Jul 21, 2013

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.

@featureenvy
Copy link

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.

@trystant
Copy link

I'm running into this as well; @featureenvy's solution hasn't worked for me. Digging for one...

@dnajd
Copy link

dnajd commented Sep 4, 2014

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?

@searls
Copy link
Member

searls commented Sep 4, 2014

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:
#46 (comment)

@dnajd
Copy link

dnajd commented Sep 4, 2014

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.

@searls
Copy link
Member

searls commented Sep 4, 2014

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:
#46 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants