I want to run function specifications in my rails application that runs on ubuntu.
I ran into this error:
f.QueryInterface is not a function
The following are the steps to reproduce this problem:
Install ubuntu Install ruby 2.2.2p95 gem install rails -v 4.2.1 cd /tmp/ rails new myapp
vi gemfile, so I have the following:
ruby "2.2.2" source 'https://rubygems.org' gem 'thin' ,'1.6.3' gem 'rails_12factor','0.0.3' gem 'haml', '4.0.6' gem 'haml-rails', '0.9.0' gem 'pg', '0.18.1' gem 'rails', '4.2.1' gem 'sass-rails', '~> 5.0' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.1.0' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' group :development, :test do gem 'websocket' ,'1.2.2' gem 'ffi' ,'1.9.8' gem 'childprocess' ,'0.5.6' gem 'rubyzip' ,'1.1.7' gem 'selenium-webdriver','2.46.2' gem 'xpath' ,'2.0.0' gem 'capybara' ,'2.4.4' gem 'rspec-support' ,'3.3.0' gem 'diff-lcs' ,'1.2.5' gem 'rspec-mocks' ,'3.3.0' gem 'rspec-expectations','3.3.0' gem 'rspec-core' ,'3.3.1' gem 'rspec-rails' ,'3.3.2' gem 'therubyracer', platforms: :ruby gem 'byebug' gem 'web-console', '~> 2.0' end
Then do the following:
cd /tmp/myapp/ bundle install bin/rails g rspec:install echo "require 'capybara/rspec'" >> spec/spec_helper.rb mkdir spec/features/
Then do the following:
vi spec/features/myfeature_spec.rb
so i have this syntax:
describe 'some stuff which requires js', :js => true, :type => :feature do it 'does something' do visit '/hi/index' end end
Then do the following:
bin/rails g controller hi index bundle exec rspec spec/features/myfeature_spec.rb
screen dump of what i see:
dan@ann15 :/tmp/myapp $ bundle exec rspec spec/features/myfeature_spec.rb F Failures: 1) some stuff which requires js does something Failure/Error: visit '/hi/index' Selenium::WebDriver::Error::UnknownError: f.QueryInterface is not a function
I think this should not cause errors.
I follow the instructions that I see at this URL: https://github.com/jnicklas/capybara#using-capybara-with-rspec
I suspect a mistake in the documentation. I doubt that I have all the steps that I need to complete.
What steps should I follow to get this to work?