Skip to content

Instantly share code, notes, and snippets.

@antonymarcano
antonymarcano / PostCode.java
Created August 24, 2012 06:42
PostCode exercise (unfinished) in Java
package com.riverglide.addressservice;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
public class PostCode {
private static final String VALID_OUTCODE = "\\d[A-Z][A-Z]";
private static final int OUTCODE_LENGTH = 3;
private String inCode;
@antonymarcano
antonymarcano / restricted_content.feature
Created March 17, 2012 11:33
The Cucumber Book – Imperative vs. Declarative
Feature: Cucumber Book v1 Imperative Steps P91
These are the scenarios from the Cucumber Book showing Imperative vs. Declarative style
I think the ideas in the book are great but I think that the examples can go further.
# Imperative example from the book
Scenario: Redirect user to originally requested page after logging in
Given a User "dave" exists with password "secret"
And I am not logged in
When I navigate to the home page
Then I am redirected to the login form
$:.unshift(File.dirname(__FILE__), ".")
require 'rubygems'
require 'rspec'
module Butler
def put_fork_on_the_left_of place
place.unshift "fork"
place
end
$:.unshift(File.dirname(__FILE__), ".")
require 'rubygems'
require 'rspec'
module Butler
def self.extended base
base.get_ready
end