Skip to content

Instantly share code, notes, and snippets.

@sunaot
Created October 14, 2014 16:05
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 sunaot/9b2c7868fee2b63e4972 to your computer and use it in GitHub Desktop.
Save sunaot/9b2c7868fee2b63e4972 to your computer and use it in GitHub Desktop.
Spock のようななにかを Ruby で。の仮実装。これは spec 側。実装は https://gist.github.com/sunaot/9efce49897e3dbf98fca にあります。
class Foo
extend Ruby::Spock
spec 'maximum of two numbers', ->(*) {
expect ->(a, b, c) { [a, b].max == c }
where [
# a | b | c
[ 1 , 3 , 3 ],
[ 7 , 4 , 4 ],
[ 0 , 0 , 0 ],
]
}
spec 'minimum of two numbers' do
expect ->(a, b, c) { [a, b].min == c }
where [
# a | b | c
[ 1 , 3 , 1 ],
[ 7 , 4 , 4 ],
[ 0 , 0 , 0 ],
]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment