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

Capybara RSpec vs. test adapter #4

Closed
palkan opened this issue Nov 14, 2017 · 0 comments
Closed

Capybara RSpec vs. test adapter #4

palkan opened this issue Nov 14, 2017 · 0 comments

Comments

@palkan
Copy link
Owner

palkan commented Nov 14, 2017

Currently, setting test adapter globally breaks multisession Capybara Action Cable tests.

We can add a share context to use another adapter (e.g. async) for specific tests and (optionally) include it to type: :feature specs:

context "multiple sessions", action_cable: :async do
  scenario "all users see new question in real-time" do
    Capybara.using_session('author') do
      sign_in(user)
      visit questions_path
    end

    Capybara.using_session('guest') do
      visit questions_path
    end

    Capybara.using_session('author') do
      page.find("#add_question_btn").trigger('click')

      fill_in 'Title', with: 'Test question'
      fill_in 'Body', with: 'test text'
      click_on 'Save'
      expect(page).to have_content 'Test question'
      expect(page).to have_content 'test text'
    end

    Capybara.using_session('guest') do
      expect(page).to have_content 'Test question'
      expect(page).to_not have_content 'No questions found('
    end
  end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant