This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import deepFreeze from 'deep-freeze' | |
import configureStore from '../app/store/' | |
export const reduce = (actions) => { | |
const store = configureStore() | |
actions.forEach(action => store.dispatch(action)) | |
return store.getState() | |
} | |
export const reductio = (reducer, actions) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
GEMFILE=Gemfile.lock | |
[ $# -lt 1 ] && { echo "Usage: $0 cmd" >&2; return 1; } | |
[ -r $GEMFILE ] || { echo "Cannot find $GEMFILE" >&2; return 1; } | |
cmd="$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Checkout { | |
private Money balance = Money.ZERO; | |
private MultibuyDiscount discount; | |
public Checkout(MultibuyDiscount discount) { | |
this.discount = discount.reset(); | |
} | |
public Checkout scan(String sku, Money price) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import org.junit.Before; | |
import org.junit.Test; | |
public class OsheroveTests { | |
private Calculator calculator; | |
@Before | |
public void setUp() throws Exception { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ocpCalc; | |
import java.util.HashMap; | |
import java.util.Map; | |
public class CalculatorFactory { | |
public Calculator create() { | |
BinaryInfixParser arithmeticParser = new BinaryInfixParser(operators()); | |
Parser parser = new EmptyStringParser(arithmeticParser); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AdjustQualityBy implements Adjuster { | |
private int adjustment; | |
public AdjustQualityBy(int adjustment) { | |
this.adjustment = adjustment; | |
} | |
public void adjust(Item item) { | |
item.setQuality(item.getQuality() + adjustment); | |
if (item.getSellIn() < 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pair = Struct.new(:head, :tail) | |
Either = Struct.new(:val) | |
class Left < Either | |
def value(pair, hylo) | |
pair.head | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class OcpPotterTester { | |
private double price(int... books) { | |
Basket basket = new BasketFactory().create(); | |
return basket.bestPrice(books); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import org.junit.Test; | |
public class PotterTester { | |
private double price(int... books) { | |
return 0.0; | |
} | |
@Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context 'EventBus methods cascade' do | |
context 'clear' do | |
When(:result) { EventBus.clear } | |
Then { result.should == EventBus } | |
end | |
context 'publish' do | |
When(:result) { EventBus.publish('aa123bb', {}) } | |
Then { result.should == EventBus } |
NewerOlder