RSpec/Capybara testing have_selector conundrum

RSpec/Capybara testing have_selector conundrum

By : user2949862
Date : November 17 2020, 04:28 AM
I wish did fix the issue. This is from Ruby on Rails Tutorial by Michael Hartl 2nd edition. The 3rd (and currently latest) edition does not test with RSpec so I decided to use this book. , Try:
code :
expect(page).to have_selector('title', 
                     :text => "Ruby on Rails Tutorial Sample App | Home",
                     :visible => false)

Share : facebook icon twitter icon
Rspec + Capybara + requests: have_selector not returning anything

Rspec + Capybara + requests: have_selector not returning anything

By : bash0r1988
Date : March 29 2020, 07:55 AM
it should still fix some issue According to the capybara docs, supplying count checks for that exact number. You're checking for 10 rows, but you have 12.
RSpec Capybara have_selector Test Not Working

RSpec Capybara have_selector Test Not Working

By : Pedro José
Date : March 29 2020, 07:55 AM
will help you More than likely, your login is failing for one reason or another.
Change your test to look like this:
code :
it "should show me my first name" do
  should have_selector('p', text: user.first_name)
it "redirects to the home page after log in" do
  current_path.should == root_path
testing with specs, capybara from railstutorial chapter 3 does not work (have_selector('title', :text => ' | Home'))

testing with specs, capybara from railstutorial chapter 3 does not work (have_selector('title', :text => ' | Home'))

By : Rohit Goyal
Date : March 29 2020, 07:55 AM
it fixes the issue I just checked your project on Github, and it seems that you are using the edge version of capybara:
code :
gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git'
  remote: git://github.com/jnicklas/capybara.git
  revision: e561d249555195cdd0e9251246fc75aae876f833
      capybara (2.0.0.beta2)
      mime-types (>= 1.16)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      selenium-webdriver (~> 2.0)
      xpath (~> 1.0.0.beta1)
Capybara 2.1.0 & Rspec 2 'have_selector' test is broken

Capybara 2.1.0 & Rspec 2 'have_selector' test is broken

By : vsri1137
Date : March 29 2020, 07:55 AM
To fix the issue you can do The reason for the error is because you're calling has_selector? on String class. has_selector? is from Capybara::Node::Matchers module.
To fix the issue, update the example with the following:
code :
it "should render the user's list of items" do
  user.items.each do |item|
    #expect(page).to have_selector("li##{item.id}", text: item.description)
    page.has_selector?("li##{item.id}", text: item.description)
Capybara and Rspec: correct way to use within() and have_selector() together?

Capybara and Rspec: correct way to use within() and have_selector() together?

By : Pedro Viana
Date : March 29 2020, 07:55 AM
hope this fix your issue Still learning Capybara myself, but have you tried have_link instead of have_selector? Also I don't think you need |ref|. For example:
Related Posts Related Posts :
  • how to create two custom registration forms in devise?
  • Rails 4 link_to Destroy not working in Getting Started tutorial
  • How does ruby on rails dynamically define `find_by_id`, `find_by_name` methods?
  • JBuilder dynamic keys for model attributes
  • `initialize': No such file or directory - getaddrinfo (Errno::ENOENT) when Rails new app
  • What is the Ruby equivalent of Node.js' socket.io?
  • Where rails store standard helpers?
  • how to check expected result matches any of give values in rspec?
  • Form submission to create multiple objects
  • Simple Twitter Login with Rails and Email confirmation
  • Where should helpful functions for my controller go in Rails?
  • Using session variable in the Model or the other way
  • Why can't I have ruby code and comments in Embedded Ruby?
  • Rails: How can I make an object available in all views?
  • Cannot enter simply form information into SQLite DB (Rails)
  • Rails - Retain form values on failed submission. Getting "First argument in form cannot contain nil or be empty&quo
  • How to handle STI and build related models automatically?
  • Suppress an error when saving a record in Rails
  • Rails AJAX reload the page. Why?
  • How to pass user attributes to action mailer
  • Custom Validator to Prevent an appointment from being scheduled too early in day?
  • Postgres Enable TCP/IP Connection
  • How do I avoid the circular argument reference warning in activesupport
  • Unable to push to heroku master because of rails/spring version error
  • deep nested routes in rails
  • Best approach to Users Profile Images in Rails App
  • RailsInstaller: Can I maintain the gem fold when re-installing a new version?
  • couldn't find file 'jquery-ui' i get this error even after having this file in my application.js
  • Ruby regex to split user and date text input
  • Tool like BetterErrors for JRuby?
  • redirect_to in action destroy ruby on rails
  • Where are the I18n.t link and reference paths?
  • Sending emails to multiple recipients in rails app
  • Rails, Devise, Sign up = write name in other Database
  • pass custom attribute on rspec factory_girl controller test
  • rails generate uses wrong version of Ruby
  • Duplicate Requests from a Browser
  • One action in Rails controller sends no data back
  • Local data (JSON) in Middleman inside a different path than /data
  • How to pass numbers in an array into a SQL statement
  • ActiveAdmin - Allow non-logged-in users to view but not edit resources
  • How to refactor this Model logic in Rails
  • :readonly key of belongs_to method doesn't work
  • Create a new view in directory
  • nested resources in devise
  • Yaml value with a leading `!`
  • Rails admin show username instead of User #5
  • Can't start WEBrick with Byebug on
  • Failing Rspec test of a FactoryGirl object
  • engine yard No application found matching remotes:
  • Rails 4 sessions cookie is not set
  • How do I flush a class method in Rails 4 using memcached?
  • AJAX form submitting in HTML rails 4
  • Using greater than or less than in a Rails Active Record query
  • Searching Post by Origin & Destination locations using Geokit-Rails
  • Deploying application to two different servers, with different production.rb contents
  • Spree with deface - Use deface to replace contents of block
  • I need to change date part of DateTime variable
  • Ruby on Rails 4 - Using Rake on Heroku
  • Ruby symbol setup
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org