Решение на Трета задача от Емилиян Янков
Обратно към всички решения
Към профила на Емилиян Янков
Резултати
- 1 точка от тестове
- 0 бонус точки
- 1 точка общо
- 3 успешни тест(а)
- 16 неуспешни тест(а)
Код
Лог от изпълнението
.FF..FFFFFFFFFFFFFF
Failures:
1) Inventory with no discounts has some constraints on prices and counts
Failure/Error: expect { inventory.register 'Negative', '-10.00' }.to raise_error
expected Exception but nothing was raised
# /tmp/d20111115-5847-1wiga45/spec.rb:55:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) Inventory with no discounts can print an invoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x95e5c00>
# /tmp/d20111115-5847-1wiga45/spec.rb:73:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) Inventory with a 'buy X, get one free' promotion shows the discount in the invoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x95e361c>
# /tmp/d20111115-5847-1wiga45/spec.rb:111:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) Inventory with a '% off for every n' promotion gives % off for every group of n
Failure/Error: cart.total.should eq '3.20'.to_d
NameError:
undefined local variable or method `name' for #<Cart:0x95e28fc>
# /tmp/d20111115-5847-1wiga45/solution.rb:75:in `check_package'
# /tmp/d20111115-5847-1wiga45/solution.rb:89:in `include_promo'
# /tmp/d20111115-5847-1wiga45/solution.rb:65:in `block in total'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `each'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:131:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) Inventory with a '% off for every n' promotion does not discount for extra items, that don't fit in a group
Failure/Error: cart.total.should eq '1.80'.to_d
NameError:
undefined local variable or method `name' for #<Cart:0x942b1a8>
# /tmp/d20111115-5847-1wiga45/solution.rb:75:in `check_package'
# /tmp/d20111115-5847-1wiga45/solution.rb:89:in `include_promo'
# /tmp/d20111115-5847-1wiga45/solution.rb:65:in `block in total'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `each'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:141:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) Inventory with a '% off for every n' promotion shows the discount in the invoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x942a578>
# /tmp/d20111115-5847-1wiga45/spec.rb:154:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
7) Inventory with a '% off of every item after the nth' promotion gives a discount for every item after the nth
Failure/Error: cart.total.should eq '15.40'.to_d
NameError:
undefined local variable or method `name' for #<Cart:0x9429858>
# /tmp/d20111115-5847-1wiga45/solution.rb:80:in `check_threshold'
# /tmp/d20111115-5847-1wiga45/solution.rb:92:in `include_promo'
# /tmp/d20111115-5847-1wiga45/solution.rb:65:in `block in total'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `each'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:174:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
8) Inventory with a '% off of every item after the nth' promotion does not give a discount if there are no more than n items in the cart
Failure/Error: cart.total.should eq '10.00'.to_d
NameError:
undefined local variable or method `name' for #<Cart:0x9428c00>
# /tmp/d20111115-5847-1wiga45/solution.rb:80:in `check_threshold'
# /tmp/d20111115-5847-1wiga45/solution.rb:92:in `include_promo'
# /tmp/d20111115-5847-1wiga45/solution.rb:65:in `block in total'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `each'
# /tmp/d20111115-5847-1wiga45/solution.rb:63:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:184:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
9) Inventory with a '% off of every item after the nth' promotion shows the discount in the ivnoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x98b5b38>
# /tmp/d20111115-5847-1wiga45/spec.rb:197:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
10) Inventory with a '% off' coupon gives % off of the total
Failure/Error: cart.total.should eq '8.00'.to_d
NameError:
undefined local variable or method `coupon_name' for #<Cart:0x98b4df0>
# /tmp/d20111115-5847-1wiga45/solution.rb:69:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:220:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
11) Inventory with a '% off' coupon applies the coupon discount after product promotions
Failure/Error: cart.total.should eq '9.00'.to_d
NameError:
undefined local variable or method `coupon_name' for #<Cart:0x98b40e4>
# /tmp/d20111115-5847-1wiga45/solution.rb:69:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:230:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
12) Inventory with a '% off' coupon shows the discount in the invoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x98b348c>
# /tmp/d20111115-5847-1wiga45/spec.rb:240:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
13) Inventory with an 'amount off' coupon subtracts the amount form the total
Failure/Error: cart.total.should eq '2.00'.to_d
NameError:
undefined local variable or method `coupon_name' for #<Cart:0x98b271c>
# /tmp/d20111115-5847-1wiga45/solution.rb:69:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:261:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
14) Inventory with an 'amount off' coupon does not result in a negative total
Failure/Error: cart.total.should eq '0.00'.to_d
NameError:
undefined local variable or method `coupon_name' for #<Cart:0x945ea30>
# /tmp/d20111115-5847-1wiga45/solution.rb:69:in `total'
# /tmp/d20111115-5847-1wiga45/spec.rb:271:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
15) Inventory with an 'amount off' coupon shows the discount in the invoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x945ddec>
# /tmp/d20111115-5847-1wiga45/spec.rb:281:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
16) Inventory with multiple discounts can print an invoice
Failure/Error: cart.invoice.should eq <<INVOICE
NoMethodError:
undefined method `invoice' for #<Cart:0x945ce60>
# /tmp/d20111115-5847-1wiga45/spec.rb:309:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.55494 seconds
19 examples, 16 failures
Failed examples:
rspec /tmp/d20111115-5847-1wiga45/spec.rb:47 # Inventory with no discounts has some constraints on prices and counts
rspec /tmp/d20111115-5847-1wiga45/spec.rb:64 # Inventory with no discounts can print an invoice
rspec /tmp/d20111115-5847-1wiga45/spec.rb:104 # Inventory with a 'buy X, get one free' promotion shows the discount in the invoice
rspec /tmp/d20111115-5847-1wiga45/spec.rb:127 # Inventory with a '% off for every n' promotion gives % off for every group of n
rspec /tmp/d20111115-5847-1wiga45/spec.rb:137 # Inventory with a '% off for every n' promotion does not discount for extra items, that don't fit in a group
rspec /tmp/d20111115-5847-1wiga45/spec.rb:147 # Inventory with a '% off for every n' promotion shows the discount in the invoice
rspec /tmp/d20111115-5847-1wiga45/spec.rb:170 # Inventory with a '% off of every item after the nth' promotion gives a discount for every item after the nth
rspec /tmp/d20111115-5847-1wiga45/spec.rb:177 # Inventory with a '% off of every item after the nth' promotion does not give a discount if there are no more than n items in the cart
rspec /tmp/d20111115-5847-1wiga45/spec.rb:190 # Inventory with a '% off of every item after the nth' promotion shows the discount in the ivnoice
rspec /tmp/d20111115-5847-1wiga45/spec.rb:213 # Inventory with a '% off' coupon gives % off of the total
rspec /tmp/d20111115-5847-1wiga45/spec.rb:223 # Inventory with a '% off' coupon applies the coupon discount after product promotions
rspec /tmp/d20111115-5847-1wiga45/spec.rb:233 # Inventory with a '% off' coupon shows the discount in the invoice
rspec /tmp/d20111115-5847-1wiga45/spec.rb:254 # Inventory with an 'amount off' coupon subtracts the amount form the total
rspec /tmp/d20111115-5847-1wiga45/spec.rb:264 # Inventory with an 'amount off' coupon does not result in a negative total
rspec /tmp/d20111115-5847-1wiga45/spec.rb:274 # Inventory with an 'amount off' coupon shows the discount in the invoice
rspec /tmp/d20111115-5847-1wiga45/spec.rb:295 # Inventory with multiple discounts can print an invoice
История (1 версия и 0 коментара)
Емилиян обнови решението на 07.11.2011 13:51 (преди около 13 години)