Skip to content

Commit

Permalink
refactored tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DClaudio committed Feb 16, 2015
1 parent 1b095bd commit a0860f3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/potter_books_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

describe 'Potter Books Price Calculator' do

it 'should return the price for 0 books' do
expect(final_price([])).to eq(0)
end

describe 'The price for identical books' do
it 'should return the price for 1x book' do
expect(final_price([1,0,0,0,0])).to eq(8)
expect(final_price([0,1,0,0,0])).to eq(8)
expect(final_price([0,0,0,1,0])).to eq(8)
end
it 'should return the price for multiple identical books' do
expect(final_price([2,0,0,0,0])).to eq(16)
Expand All @@ -16,24 +18,22 @@
end
end

describe 'The price for two different books' do
describe 'The price for different books' do
it 'should return the price for 2x different books' do
expect(final_price([1,1,0,0,0])).to eq(15.2)
expect(final_price([0,1,0,0,0])).to eq(8)
expect(final_price([0,0,0,1,0])).to eq(8)
end
it 'should return the price for 2x different books and one identical' do
#expect(final_price([2,1,0,0,0])).to eq(23.2)
#expect(final_price([0,1,0,0,0])).to eq(8)
#expect(final_price([0,0,0,1,0])).to eq(8)
it 'should return the price for 3x different books' do
expect(final_price([1,0,1,0,1])).to eq(21.6)
end

end

describe 'The price for three different books' do
it 'should return the price for 3x different books' do
expect(final_price([1,1,1,0,0])).to eq(21.6)
expect(final_price([0,1,1,1,0])).to eq(21.6)
expect(final_price([1,0,1,0,1])).to eq(21.6)
describe 'The price for different books and identical' do
it 'should return the price for 2x different books and one identical' do
expect(final_price([2,0,0,1,0])).to eq(23.2)
end
it 'should return the price for 3x different books and one identical' do
expect(final_price([2,0,1,0,1])).to eq(29.6)
end
end

Expand Down

0 comments on commit a0860f3

Please sign in to comment.