Skip to content

Instantly share code, notes, and snippets.

@farnoy
Created February 26, 2012 10:53
Show Gist options
  • Save farnoy/1916036 to your computer and use it in GitHub Desktop.
Save farnoy/1916036 to your computer and use it in GitHub Desktop.
$:.unshift './'
require 'calculator'
describe Calculator do
describe :constructor do
it 'should take many arguments' do
args = [1, 2, 3, 4]
Calculator.new(*args).values.should eq(args)
end
end
describe :calculation do
describe 'for values: 3, 2' do
subject { Calculator.new(3, 2) }
its(:sum) { should equal(5) }
its(:subtract) { should equal(1) }
end
describe 'for values: 3, 5, 8' do
subject { Calculator.new(3, 5, 8) }
its(:sum) { should equal(16) }
its(:subtract) { should equal(-10) }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment