https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png
![](https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png | width=100)
#!/bin/bash | |
OPENSSL_VERSION="1.0.1o" | |
curl -O -L http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_i386 | |
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz | |
mv openssl-$OPENSSL_VERSION openssl_x86_64 | |
cd openssl_i386 |
# Install older OpenSSL 1.0.0 from source on Mac OS X to install Ruby version compatible (like 1.8.7) | |
# prepare workspace | |
mkdir -p ~/code/build-from-src/ && cd $_ | |
# download source code | |
curl -LO https://www.openssl.org/source/openssl-1.0.0.tar.gz | |
# expand tar | |
tar -xzvf openssl-1.0.0.tar.gz |
In Rails 5, the preferred base class for testing controllers is ActionDispatch::IntegrationTest
.
If you have an API that receives parameters as JSON request bodies, here are some helper methods to facilitate testing:
class ActionDispatch::IntegrationTest
def put_json(path, obj)
put path, params: obj.to_json, headers: { 'CONTENT_TYPE' => 'application/json' }
end
class DummyController < ApplicationController | |
def do | |
render json: { balance: 50 } | |
end | |
end |
Fluxo de Trabalho no Git | |
======================== | |
Primeiro crie um branch de desenvolvimento no seu repositório local: | |
$ git checkout --track origin/development | |
1. Trabalhe em sua tarefa, continuamente comitando em intervalos regulares para manter | |
o rastro daquilo que você fez. |
git archive --format zip --output /full/path/to/zipfile.zip master |
#!/bin/bash | |
# Source: http://blog.nonuby.com/blog/2012/07/05/copying-env-vars-from-one-heroku-app-to-another/ | |
set -e | |
sourceApp="$1" | |
targetApp="$2" | |
while read key value; do |
curl \ | |
-H "Content-Type: application/json" \ | |
-H "Authorization: <REPLACE_WITH_YOUR_API_KEY>" \ | |
-X POST -d '{"options":{"open_tracking":true,"click_tracking":true},"return_path":"bounces@<REPLACE_WITH_YOUR_SENDING_DOMAIN_HERE>","metadata":{"some_useful_metadata":"testing_sparkpost"},"substitution_data":{"signature":"<REPLACE_WITH_YOUR_FIRST_AND_LAST_NAME>"},"recipients":[{"address":{"email":"<REPLACE_WITH_YOUR_EMAIL_ADDRESS>","tags":["learning"],"substitution_data":{"customer_type":"Platinum","first_name":"<REPLACE_WITH_YOUR_FIRST_NAME>"}}}],"content":{"from":{"name":"Awesome Company","email":"testing@<REPLACE_WITH_YOUR_SENDING_DOMAIN>"},"subject":"My first SparkPost Transmission","reply_to":"Awesome Company ","text":"Hi {{address.first_name}}\r\nYou have just sent your first email through SparkPost!\r\nCongratulations,\r\n{{signature}}","html":"<strong>Hi {{address.first_name}},</strong><p>You have just sent your first email through SparkPost!</p><p>Congratulations!</p>{{signature}}"}}' \ | |
https://api.sparkpos |
This written tutorial is a concise version of this tutorial, which covers building a payment system into a Rails app using Stripe.js. It assumes a basic familiarity with Ruby on Rails, Git and the command-line.