Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

loop do
# some code to be iterated
end
@jtorreggiani
jtorreggiani / routes.rb
Created February 25, 2019 21:48
config/routes.rb
Rails.application.routes.draw do
resources :posts
root "posts#index"
end
@jtorreggiani
jtorreggiani / database.yml
Created February 26, 2019 00:15
config/database.yml
production:
<<: *default
username: deploy
password: [PASSWORD]
database: skeleton_application_production
socket: "/cloudsql/skeleton-application-12345:us-west2:skeleton-application-cloudsql-instance"
@jtorreggiani
jtorreggiani / app.yml
Last active February 26, 2019 00:38
app.yml
entrypoint: bundle exec rackup --port $PORT
env: flex
runtime: ruby
env_variables:
SECRET_KEY_BASE: SECRET_BASE
beta_settings:
cloud_sql_instances: skeleton-application-12345:us-west2:skeleton-application-cloudsql-instance
@jtorreggiani
jtorreggiani / App.integration.test.js
Last active March 1, 2019 22:51
Integration test boilerplate code
// Import the remote function from webdriver
import { remote } from 'webdriverio'
// Describe a basic scenario
describe('User visits home page', () => {
// Define a browser variable to be available to each
// assertion that will be declared below
let browser
// Before all the assertions we set up the browser object
// The default configuration for webdriver is async mode,
// so we will need to be defined our specs as async functions.
@jtorreggiani
jtorreggiani / headingtext.spec.js
Last active March 1, 2019 23:51
Introduction test assertion
it('has introduction text', async () => {
// Use the browser selector method to get the heading
// See docs for details https://webdriver.io/docs/selectors.html
const paragraph = await browser.$('p')
await expect(paragraph.getText()).resolves.toEqual('Edit src/App.js and save to reload.')
})
@jtorreggiani
jtorreggiani / App.js
Created March 1, 2019 22:13
Basic React Router app
import React from 'react'
import './App.css'
import { BrowserRouter as Router, Route, Link } from 'react-router-dom'
function Home () {
return (
<div>
<h1>Home</h1>
</div>
)
@jtorreggiani
jtorreggiani / App.css
Last active March 1, 2019 22:19
Super basic app styles
.App-nav {
display: flex;
flex-direction: row;
padding: 5px;
}
.App-nav > a {
flex: 1 1 auto;
text-align: center;
padding:0 15px;
@jtorreggiani
jtorreggiani / homepagetext.spec.js
Last active March 1, 2019 22:51
Updated assertion
it('has home page text', async () => {
const heading = await browser.$('h1')
await expect(heading.getText()).resolves.toEqual('Home')
})
@jtorreggiani
jtorreggiani / links.spec.js
Last active March 1, 2019 22:52
Assert existence of links