Skip to content

Instantly share code, notes, and snippets.

View danascheider's full-sized avatar

Dana Scheider danascheider

View GitHub Profile
source 'https://rubygems.org'
gem 'bundler', '~> 1.5.2'
gem 'rake', '~> 10.3.2'
gem 'certificate_authority', '~> 0.1.6'
@danascheider
danascheider / Testing Element Visibility in Capybara-Cucumber (UNFINISHED)
Created April 24, 2015 19:04
The finer points of testing element visibility
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
@danascheider
danascheider / README.md
Last active August 29, 2015 14:27
Sorted Array of 50 Abbreviated US States (Excluding Territories)

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.

@danascheider
danascheider / Intro - Backbone, Require.js, Mocha, and Chai
Last active April 18, 2016 17:45
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
@danascheider
danascheider / .rspec
Created July 15, 2016 22:19
Function to flatten an array
--format documentation
--color
--require spec_helper
@danascheider
danascheider / README.md
Last active February 13, 2017 21:03
Testing Backbone View Events with Mocha, Chai, Sinon, and Require.js

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.

@danascheider
danascheider / Gemfile
Last active May 26, 2018 00:06
Cucumber Ruby Core Issue #153
source "https://rubygems.org"
ruby "2.4.0"
gem "cucumber", "3.1.0"
gem "watir"
gem "webdrivers"
gem "byebug"
class File < ApplicationRecord
has_one_attached :file
end
class File < ApplicationRecord
has_one_attached :file
scope :without_attached_file, -> { left_joins(:file_attachment).where('active_storage_attachments.id IS NULL') }
end
@danascheider
danascheider / git-status-output
Created May 19, 2021 03:23
git status output
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
hello_world.rb
nothing added to commit but untracked files present (use "git add" to track)