Skip to content

Instantly share code, notes, and snippets.

View rewinfrey's full-sized avatar
🏄‍♂️
fix f = let x = f x in x

Rick Winfrey rewinfrey

🏄‍♂️
fix f = let x = f x in x
View GitHub Profile
# Support for Rspec / Capybara subdomain integration testing
# Make sure this file is required by spec_helper.rb
# (e.g. save as spec/support/subdomains.rb)
def switch_to_subdomain(subdomain)
# lvh.me always resolves to 127.0.0.1
hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me"
Capybara.app_host = "http://#{hostname}"
end
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
class MyStruct
def self.new(*method_names, &block)
raise ArgumentError, "wrong number of arguments (0 for 1+)" if method_names.empty?
Class.new do
class_eval &block if block
include Enumerable
def initialize(*args)