There has always been more to Red-Green-Refactor than the inner loop alone. TDD has an outer loop too — one that many practitioners missed in the original literature and had to rediscover the hard way. The outer loop defines new behaviour as an executable scenario; the inner loop refines the implementation until that scenario passes. Together they produce a growing suite of living specifications that catch regressions whenever something changes.
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
| from pathlib import Path | |
| import subprocess | |
| import sys | |
| GIT_TRACKED = 0 | |
| GIT_UNTRACKED = 1 | |
| # Better to load from a config file | |
| _deny = frozenset({Path("/"), Path("/home"), Path("/usr")}) |
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 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; |
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
| 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 |
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
| $:.unshift(File.dirname(__FILE__), ".") | |
| require 'rubygems' | |
| require 'rspec' | |
| module Butler | |
| def put_fork_on_the_left_of place | |
| place.unshift "fork" | |
| place | |
| 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
| $:.unshift(File.dirname(__FILE__), ".") | |
| require 'rubygems' | |
| require 'rspec' | |
| module Butler | |
| def self.extended base | |
| base.get_ready | |
| end |