natritmeyer/site_prism
SitePrism adds a semantic Page Object Model DSL for Capybara acceptance tests, making site interfaces easier to model and query with reusable page and section objects.
Resolving Element cannot be scrolled into view (Selenium::WebDriver::Error::MoveTargetOutOfBoundsError) on Mavericks
Selenium and Cucumber tests on Mavericks can fail with MoveTargetOutOfBoundsError when Firefox starts on a different monitor than the focused Terminal window.
NoMethodError: undefined method `cache' for Gem:Module
Rails 2.3 tests can fail with NoMethodError: undefined method 'cache' for Gem:Module when used with newer RubyGems; downgrading RubyGems restores generator lookup behavior.
VCR and the webdrivers gem
VCR can complain when webdrivers checks the internet for driver updates during tests. Updating locally, ignoring the update host, or pinning the driver version avoids the noise.
Cucumber: Removing uploaded files after test runs
Uploaded test files can linger after Cucumber feature runs; placing cleanup code in features/support/ removes them automatically.
Pierce through Javascript closures and access private symbols
Accessing state hidden in JavaScript closures can simplify tests and let Jasmine spies mock private methods or inspect local variables.
Test that a select field contains an option with Cucumber
Cucumber steps can verify that a form select contains or excludes a specific option, without checking the currently selected value.
Capybara: How to find a hidden field by its label
Hidden form inputs are ignored by default in Capybara, causing find_field to fail unless type: :hidden is specified. This helps when tests must wait for JavaScript widgets to populate a field value.
Upgrading Ruby from 1.8.7 to 2.3.5
Ruby 2.3.5 migration from 1.8.7 needs gem updates, syntax fixes, and test adjustments to resolve compatibility errors across Rails apps.
Rails: Default generators
Default Rails generators create different combinations of models, controllers, migrations, routes, views, and tests, helping choose the right generator from the command line.
Test that an exception or error page is raised in Capybara
Capybara error-page assertions rely on the response status code and require @allow-rescue; Selenium @javascript scenarios do not support page.status_code.
Pattern: Disabling a certain feature in tests
Integration tests often break on cookie banners or captchas. A test-only switch disables them by default while allowing targeted reactivation for specific cases.
ActiveRecord: count vs size vs length on associations
size is usually the right way to count associated records in Rails; count can ignore loaded children, while length loads everything.
RSpec expects pending tests to fail
Pending RSpec examples need a failing body; otherwise a passing pending example is treated as a failure. Omit the body, add fail, or skip with xit/xdescribe.
Aggregated RSpec/Cucumber test coverage with RCov
RCov defaults fail to aggregate RSpec and Cucumber coverage cleanly; a custom rake rcov:all task produces a Rails report for app/**/*.rb only.
How to remove RSpec "old syntax" deprecation warnings
RSpec 3 deprecates :should expectations, causing warnings in older test suites and gems that need backward compatibility. RSpec.configure can re-enable both syntax styles.
Removing MiniTest warnings from Rails 4 projects
MiniTest deprecation warnings in Rails 4 often come from older test gems using the outdated API; adding minitest can silence one warning, but some require gem updates.
Tearing Down Capybara Tests of AJAX Pages
Pending AJAX requests can die when a Capybara test ends or switches scenarios, causing flaky JavaScript specs. Waiting for the page to load helps avoid the failure.
How to silence thin boot messages
Thin prints startup messages that clutter parallel test output. Logging can be silenced with Thin::Logging.silent = true or redirected to a custom logger.
How to change will_paginate's "per_page" in Cucumber features
Pagination tests in Cucumber often need fewer records than the default will_paginate page size. Stubbing per_page per model keeps feature scenarios small.
Rules of thumb against flaky specs
Flaky specs often come from brittle matchers, nondeterministic record limits, and UI components that load or animate asynchronously.
Project management best practices: Technical debt summary
Prioritizing refactoring and upgrade work is harder in larger projects; a maintained technical-debt summary helps compare effort, customer value, and developer value.
Testing Accessibility using Orca
Linux screen reader testing can be noisy and hard to inspect; capturing Orca speech in real time makes spoken output readable during accessibility checks.
Hack of the day: One-liner to run all changed Cucumber features
Run only modified or new Cucumber feature files from git status, reducing test time by avoiding unchanged specs.