This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'csv' | |
require 'json' | |
if ARGV.size != 2 | |
puts 'Usage: csv_to_json input_file.csv output_file.json' | |
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects' | |
exit(1) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rake Quick Reference | |
# by Greg Houston | |
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html | |
# ----------------------------------------------------------------------------- | |
# Running Rake | |
# ----------------------------------------------------------------------------- | |
# running rake from the command-line: | |
# rake --help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "spec_helper" | |
describe ExampleController do | |
context "GET #index" do | |
let(:resources) { FactoryGirl.create_list(:resource) } | |
before do | |
get :index | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Custom rspec matcher for testing CanCan abilities. | |
# Originally inspired by https://github.com/ryanb/cancan/wiki/Testing-Abilities | |
# | |
# Usage: | |
# should have_abilities(:create, Post.new) | |
# should have_abilities([:read, :update], post) | |
# should have_abilities({manage: false, destroy: true}, post) | |
# should have_abilities({create: false}, Post.new) | |
# should not_have_abilities(:update, post) | |
# should not_have_abilities([:update, :destroy], post) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:javascript | |
$(document).ready(function() { | |
window.loadIngredientSuggestionsEditor(#{@ingredients}); | |
}); | |
%h1 Edit ingredient suggestions | |
#js-ingredient-suggestions-editor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# force HTTPS and www. | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} (?!^www\.)^(.+)$ [OR] | |
RewriteCond %{HTTPS} off | |
RewriteRule ^ https://www.%1%{REQUEST_URI} [R=301,L] | |
# alternative way | |
RewriteCond %{HTTP_HOST} !^$ | |
RewriteCond %{HTTP_HOST} !^www\. [NC] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "2" | |
services: | |
dev: | |
image: ruby:2.3 | |
volumes: | |
- .:/project | |
- ruby2.3-bundle-cache:/usr/local/bundle | |
working_dir: /project |
OlderNewer