github.com/deniseyu
Testing code allows developers to know that the code is working as expected,
no more, and no less.
deniseyu@Winter-Is-Coming » gem install rspec
Successfully installed rspec-3.2.0
Parsing documentation for rspec-3.2.0
Installing ri documentation for rspec-3.2.0
Done installing documentation for rspec after 0 seconds
1 gem installed
deniseyu@Winter-Is-Coming » rspec spec/something_awesome_spec.rb
require 'fizzbuzz'
describe Fizzbuzz do
it 'says "Fizz" on a number that divides by 3' do
fizzbuzz = Fizzbuzz.new
expect(fizzbuzz.says(3)).to eq 'Fizz'
end
end
spec/fizzbuzz_spec.rb
class Fizzbuzz
def says(number)
'Fizz' if number % 3 == 0
end
end
lib/fizzbuzz.rb
Take that, failing tests!