Instantly share code, notes, and snippets.

View Gemfile
source "https://rubygems.org"
ruby "2.4.0"
gem "cucumber", "3.1.0"
gem "watir"
gem "webdrivers"
gem "byebug"
View .rspec
--format documentation
--color
--require spec_helper
View README.md

I had to search everywhere to find a decent sorted array of all 50 states that I could copy and paste into my code. The result was that I had to spend a stupid amount of time copying the damned things myself. Hopefully this can spare others the trouble. Most of the languages I can think of will work with an array in this format with minimal modifications that should be possible using a decent find-and-replace. I hope this saves some other unfortunate developer the headache.

View Testing Element Visibility in Capybara-Cucumber (UNFINISHED)
In this gist I'll show how I solved the problem of testing the visibility of elements using Capybara/Cucumber integration tests. The tests are being run against a locally-hosted site and do not have access to its internals, so I'm leaving the internals out here. Do note that the app itself is written in JavaScript, with only the integration tests being Ruby. The relevant file structure looks like this:
├── features/
| ├── step_definitions/
| | ├── canto_steps.rb
| ├── support/
| | ├── env.rb
| | ├── wait_for_ajax.rb
| ├── dashboard_home.feature
View README.md

This gist shows how to test events on Backbone views using Mocha, Chai, Sinon, and Require.js. The directory structure of the project being referenced, based on that of the Canto front end, can be found in my earlier gist about a related testing topic.

View Intro - Backbone, Require.js, Mocha, and Chai
This gist is an offshoot of the one by Michael Cox at https://gist.github.com/michaelcox/3800736.
I had been looking for a testing solution for a long time, and his code didn't quite work for me,
so I thought I'd share what finally did.
In all the files I'm showing here, there are additional lines of code that are omitted for brevity.
If you'd like to see the whole thing in action, you can find it at
`https://github.com/danascheider/canto`.
Relevant parts of my directory structure looked like this. The ./js/lib/chai and
./js/lib/mocha directories are the same directories that show up in your node_modules
View Gemfile
source 'https://rubygems.org'
gem 'bundler', '~> 1.5.2'
gem 'rake', '~> 10.3.2'
gem 'certificate_authority', '~> 0.1.6'