Isnor Creative
Isnor Creative Blog
Ruby, Ruby on Rails, Ember, Elm, Phoenix, Elixir, React, Vue

Nov 16, 2018

Testing vue-select with Capybara

I recently wrote some feature tests with Rspec and Capybara for a Rails application that made use of the vue-select component. This needs to be done with a js driver such as headless-chrome activated. This method worked for me:

  scenario 'prefill from book', js: true do
    visit x_path
    page.find('div.dropdown').click
    page.find('ul.dropdown-menu li a', text: item.title).click
    click_button "Submit"
    expect(page).to have_text('something expected')
  end

I have been using Vue a fair bit in a number of Ruby on Rails projects that I maintain. I’ve been finding it great for features where a full-blown single page application is not necessary, but there is interactive behavior on the page that might otherwise become a mess of hard to maintain javascript. Vue is easy to install in Rails thanks to webpacker, and a breeze to use.


I am available for Ruby on Rails and Vue consulting work – get in touch to learn more!

Gordon B. Isnor

Gordon B. Isnor writes about Ruby on Rails, Ember.js, Elm, Elixir, Phoenix, React, Vue and the web.
If you enjoyed this article, you may be interested in the occasional newsletter.

I am now available for project work. I have availability to build greenfield sites and applications, to maintain and update/upgrade existing applications, team augmentation. I offer website/web application assessment packages that can help with SEO/security/performance/accessibility and best practices. Let’s talk

comments powered by Disqus