Issues with has_select?
has_select? can fail with Cucumber, Capybara, and Selenium when the selected option has no value, so driver-specific handling may be needed.
Capybara - The missing API
Capybara node methods for locating elements, filling forms, clicking controls, and checking page content from Cucumber steps.
Fix slow specs using SOLR
Specs can stall for 30+ seconds when SOLR connections are left open and the pool is exhausted. Lowering the old-connection timeout reduces the delay.
Operators "in" and "of" are very inconsistent between CoffeeScript and JavaScript
in and of mean different things in CoffeeScript and JavaScript, making property checks and iteration easy to mix up.
Turning off VCR when stubbing with Webmock
VCR can block WebMock stubs because it hooks into WebMock and rejects unknown requests. Temporarily disabling VCR in rspec lets WebMock behave normally.
IMAP: Check credentials
IMAP login problems can be isolated by testing the server with openssl s_client and sending a manual LOGIN command to verify credentials and connectivity.
Cucumber: More patience for Selenium features
Parallel Selenium features can time out when Capybara waits too little for browser-server interactions; a support file increases patience for @javascript scenarios.
Recent RSpec features you might not know about
Less-known RSpec features simplify expectation style, chained stubs, and restoring stubbed methods while using double as the preferred mock object.
Hack-fix Selenium::WebDriver::Element#select is deprecated
Temporary monkey patch for older Capybara and selenium-webdriver versions to suppress repeated deprecation warnings from Selenium::WebDriver::Element#select.
Spreewald: Check that a CSS selector is present on the current page
Spreewald 1.3.0 adds assertions for checking whether CSS selectors are present or absent on the current page, with plain-English selector names via selector_for.
Stub a request's IP address in a Cucumber scenario
Force a fixed client IP in Cucumber scenarios when request-dependent code needs predictable behavior.
Jasmine: Expecting objects as method invocation arguments
Jasmine spy assertions can match invocation arguments by type, partial object shape, or any value using jasmine.any(), jasmine.objectContaining(), and jasmine.anything().
Colorful output for several linux command line tools: grc
Adds colorized terminal output to common Linux commands, making logs and status output easier to scan in the shell.
How to enable Rails' file_fixture helper in FactoryBot
FactoryBot factories do not get Rails' file_fixture helper by default; including RSpec Rails file fixture support makes file_fixture available and sets the fixture path.
Taking advantage of RSpec's "let" in before blocks
before :each blocks can use let values declared later, enabling per-context setup without predeclaring variables; local variables inside it blocks do not work.
RSpec: Change the type of a spec regardless of the folder it lives in
Rails specs can get controller, model, or request helpers from directory-based inference; :type forces the desired context even when a file lives elsewhere.
Using the full power of have_css
Capybara has_css? can assert selector counts and text content, including substring matches; exact text requires finding the element and comparing it directly.
JavaScript: How to check if an object is NaN
NaN is difficult to compare in JavaScript because it never equals itself. Object.is() works in ES6; ES5 needs a number type check plus isNaN().
Fixing AfterAll TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'
Jasmine describe() throws AfterAll TypeError: Failed to execute 'appendChild' on 'Node' when an object is passed instead of a string.
shoulda-matcher methods not found in Rails 4.1
allow_value and other shoulda-matchers methods can disappear under Rails 4.1 with Spring, causing NoMethodError despite the gem being listed.
Find an ActiveRecord by any column (useful for Cucumber steps)
Finds a record by any string or number across columns, making Cucumber step definitions more flexible. The bang variant raises ActiveRecord::NotFound when nothing matches.
Machinist's #make breaks on has_many associations when defining method `empty?`
Custom empty? on a has_many model can break Machinist collection building, creating records with the wrong foreign key. Use explicit association assignment instead.
Fix: Cucumber won't start though cucumber.yml is correct
cucumber.yml may be valid while rerun.txt is corrupted by parallel Cucumber workers writing at the same time, preventing Cucumber from starting.
Stubbed class methods in RSpec 1 remain stubbed in other examples
RSpec 1.x can leave stubbed class methods in place between examples, causing order-dependent failures when spec file evaluation changes.