Skip to content

Instantly share code, notes, and snippets.

View brookslyrette's full-sized avatar
🏠
Working from home from now until forever.

Brooks Lyrette brookslyrette

🏠
Working from home from now until forever.
View GitHub Profile
public class ApplicationTest {
private static final String TRAVIS_BUILD_NUMBER = "TRAVIS_BUILD_NUMBER";
private static final String TRAVIS_BRANCH = "TRAVIS_BRANCH";
private static final String TRAVIS_REPO_SLUG = "TRAVIS_REPO_SLUG";
private static final String TRAVIS_BUILD_ID = "TRAVIS_BUILD_ID";
private static FirefoxDriver driver;
private static final JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
on:
branch: staging
#!/bin/bash
# sets vars to DB back up user and creates database backup
AWS_ACCESS_KEY_ID=<key> \
AWS_SECRET_ACCESS_KEY=<secret> \
AWS_DEFAULT_REGION=us-east-1 \
aws rds create-db-snapshot --db-snapshot-identifier="before-deploy-$(date +%Y%m%d-%H%M%S)" --db-instance-identifier=<db-name>
# create a db backup before deploying
before_deploy:
- pip install --user awscli
- ./scripts/before-deploy.sh
deploy:
skip_cleanup: true
provider: elasticbeanstalk
access-key-id: <key>
secret-access-key: <secret>
region: us-east-1
app: <app-name>
env: <app-env>
bucket_name: <bucket-name>
zip_file: './web/build/libs/app-0.0.1-SNAPSHOT.war'
jar {
baseName = 'vtms-web'
from("${rootDir}/config/elastic_beanstalk/production") {
include 'env.config'
into('.ebextensions')
}
}
option_settings:
- option_name: SPRING_APPLICATION_JSON
value: '{"site":{"domainName":"ourdomain.com"},"callback":{"url":"/foo"}, "server": {"port": 5000}}'
describe('Menu', () => {
it('should render', () => {
const fakeContext = { user: { admin: false } };
const contextTypes = { user: React.PropTypes.object };
const menuComponent = wrapWithContext(fakeContext, contextTypes, <Menu />);
const renderedMenu = ReactTestUtils.renderIntoDocument(menuComponent);
//some checks go here
});
function wrapWithContext(context, contextTypes, children) {
const wrapperWithContext = React.createClass({
childContextTypes: contextTypes,
getChildContext() {
return context;
},
render() {
return children;
},
});
import React from 'react';
const UserForm = (props, context) => (
<div>
<form>
<input type="text" value={context.user.username}/>
<input type="text" value={context.user.email}/>
</form>
</div>
);