Skip to content

Instantly share code, notes, and snippets.

View NetguruGist's full-sized avatar

Netguru NetguruGist

View GitHub Profile
- name: "First things first - install latest patches"
apt: update_cache=yes upgrade=full
- name: "First things first - create random root password"
apt: name={{ item }} state=present
with_items:
{11:30}[2.2.3]~ ➭ mkdir ~/ansible; cd ~/ansible
{11:30}[2.2.3]~/ansible ➭
import { fetchQuotes } from './QuotesActions.js';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import fetchMock from 'fetch-mock';
const mockStore = configureMockStore([thunk]);
describe('QuotesActions', () => {
afterEach(() => {
fetchMock.restore();
});
export const fetchQuotes = () => dispatch => {
dispatch({ type: 'FETCH_QUOTES_REQUEST'});
return fetch('/api/random-quote')
.then(r => r.json())
.then(({ quotes }) => {
dispatch({
type: 'FETCH_QUOTES_SUCCESS',
data: quotes,
});
import quotes from './Quotes';
describe('Quotes reducer', () => {
it('returns proper initial state', () => {
expect(quotes(undefined, {})).toEqual([]);
});
it('adds the quotes', () => {
expect(quotes(['sample quote 1'], {
type: 'FETCH_QUOTES_SUCCESS',
const initialState = [];
export default (state = initialState, action) => {
switch (action.type) {
case 'FETCH_QUOTES_SUCCESS':
return [...state, ...action.data];
default:
return state;
}
}
$ npm install -g create-react-app
$ create-react-app netguru-react-redux-1
$ cd netguru-react-redux-1 && npm start
{11:30}[2.2.3]~/ansible ➭ touch inventory; touch playbook.yml
{11:31}[2.2.3]~/ansible ➭ ls
inventory    playbook.yml
{11:31}[2.2.3]~/ansible ➭
{11:30}[2.2.3]~/ansible ➭ touch inventory; touch playbook.yml
{11:31}[2.2.3]~/ansible ➭ ls
inventory    playbook.yml
{11:31}[2.2.3]~/ansible ➭
(...)
PLAY RECAP **************************************************************
<IP>          : ok=3    changed=0    unreachable=0    failed=0