Skip to content

Instantly share code, notes, and snippets.

View danieljohnmorris's full-sized avatar
😀

Daniel Morris danieljohnmorris

😀
View GitHub Profile
=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')
@danieljohnmorris
danieljohnmorris / devise_token_auth.sh
Created March 28, 2014 17:08
android rails token auth testing
curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST http://beta.sofarsounds.com/api/v1/sessions -d "{\"user\":{\"email\":\"user@example.com\",\"password\":\"secret\"}}"
curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X DELETE http://beta.sofarsounds.com/api/v1/sessions/\?auth_token\=JRYodzXgrLsk157ioYHf
curl -v -H 'Content-Type: application/json' -H 'Accept: application/json' -X POST http://beta.sofarsounds.com/api/v1/registrations -d "{\"user\":{\"email\":\"user1@example.com\",\"password\":\"secret\",\"password_confirmation\":\"secret\"}}"
# create new project
phonegap create my-app
# requires...
# - android sdk
# - brew install ant
# - adding tools and platform-tools to path
#PATH=$PATH:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/tools # android command
#PATH=$PATH:$HOME/Development/adt-bundle-mac-x86_64-20140321/sdk/platform-tools # adb command
@danieljohnmorris
danieljohnmorris / .bash_profile
Created April 11, 2014 14:35
Rails deploy scripts
# This goes in user root dir, ie ~
# So you can just call
alias deploy=./deploy.sh
alias deploy_ci=./deploy_ci.sh
alias deploy_live=./deploy_live.sh
@danieljohnmorris
danieljohnmorris / email.html
Created September 16, 2014 18:55
desk replies - new theme
{% assign emails = case.emails %}
{% assign threadlength = emails.size|minus:1 %}
{% for email in emails reversed %}
{% if forloop.first %}
{{email.new_html}}
{% if email.agent %}
{% if email.agent.signature %}
@danieljohnmorris
danieljohnmorris / email.html
Created September 16, 2014 18:56
desk replies - old
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td valign="top" style="color:#333; font-family:Arial; font-size:14px; line-height:150%; text-align:left;">
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
@danieljohnmorris
danieljohnmorris / ajax.js
Last active August 29, 2015 14:13
Ajax apply jquery
$.ajax({
type: "POST",
url: "https://www.sofarsounds.com/competitions/jessie-j/apply",
data: { _method:'POST' },
success: function(msg) {
console.log("Request complete");
}
});
@danieljohnmorris
danieljohnmorris / pg_gem_fix
Created February 23, 2015 15:47
pg gem yosemite / mavericks
# WORKSSSS!
bundle config build.pg --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
# DOESNT INCLUDE INTO BUNDLE
#gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/9.4/bin/pg_config
#Model
@user.should have(1).error_on(:username) # Checks whether there is an error in username
@user.errors[:username].should include("can't be blank") # check for the error message
#Rendering
page.should render_template(:index)
#Redirecting
page.should redirect_to(movies_path)
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
context "GET index" do
#context "POST create" do
#context "GET show" do
#context "PATCH update" do (or PUT update)
#context "DELETE destroy" do
#context "GET new" do