Skip to content
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

Devise methods don't work for websocket controller tests #415

Open
mlabarca opened this issue Jun 13, 2016 · 1 comment
Open

Devise methods don't work for websocket controller tests #415

mlabarca opened this issue Jun 13, 2016 · 1 comment

Comments

@mlabarca
Copy link

My websocket controller actions call current_user and user_signed_in methods and these work fine except for testing, where I have something of this sort:

let(:request_params) {{auth: {auth_token: journalist.user.authentication_token}, text: 'Test'}}

it 'triggers success when correct parameters are given' do
  expect(create_event('journalist_to_executive_msg', request_params).dispatch).to trigger_success_message
end

While this works in other enviroments, the test fails with this kind of error regarding devise:

expected journalist_to_executive_msg to trigger success message, instead it triggered a failure message with data undefined method `user_signed_in?'

How can i handle this when writing tests for the websockets controller? usually in other tests you have something like:

  before(:each) do
    @request.env["devise.mapping"] = Devise.mappings[:user]
    sign_in user
  end

But that doesn't work here.

@julfla
Copy link

julfla commented Dec 15, 2016

Hi, I am facing the same problem during my tests.

It seems that missing methods are not delegated the same way during test and during normal run.

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

No branches or pull requests

2 participants