Skip to content

Instantly share code, notes, and snippets.

@mverzilli
Last active January 4, 2016 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mverzilli/8542277 to your computer and use it in GitHub Desktop.
Save mverzilli/8542277 to your computer and use it in GitHub Desktop.
Diary of the development of a new feature using TDD
# Day 1, 12:00pm
# In facility_xml_generator_spec.rb, which tests the entry point for the feature I'm adding,
# I wrote a Given-When-Expect structured natural language description of my understanding of what it means for the feature to be there.
# The only piece of code so far is the construction of the SUT and a tentative name for the method that provides the
# functionality without any params.
describe 'Coded Types generation' do
it '' do
# Given that CSD codedType semantics are added to an RM's single option field by adding the metadata below to it:
# CSDType => 'codedType', codingSchema => 'foo'
# Given a collection C with three single option fields F, G, H
# F doesn't have CSD coded type semantics
# G is a list of fruits with coded type semantics
# Values in G are: "A => Apple", "B => Banana", "P => Peach"
# Metadata in G is: "CSDType => codedType", "codingSchema => fruits"
# H is a list of supermarkets with coded type semantics
# Values in H are: "C => Carrefour", "J => Jumbo"
# Metadata in H is: "CSDType => codedType", "codingSchema => supermarkets"
# X is a facility in collection C
# X.G == 'Banana'
# X.H == 'Jumbo'
# When I generate XML for the coded types of X
g = FacilityXmlGenerator.new collection
coded_types = g.generate_coded_types
# I expect:
# Exactly two codedType elements CT1 and CT2 (order doesn't matter)
# CT1 has the following features:
# Attributes => code = 'B', codingSchema = 'fruits'
# Text => "Banana"
# CT2 has the following features:
# Attributes => code = 'J', codingSchema = 'supermarkets'
# Text => "Jumbo"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment