Решение на Шеста задача от Гергана Петрова
Обратно към всички решения
Към профила на Гергана Петрова
Резултати
- 5 точки от тестове
- 0 бонус точки
- 5 точки общо
- 39 успешни тест(а)
- 8 неуспешни тест(а)
Код
Лог от изпълнението
..FF...................F..F..FF......FF........
Failures:
1) ExchangeRate#set allows rates to be updated if called multiple times
Failure/Error: expect do
result should have been changed to #<BigDecimal:a72e534,'0.149E1',18(18)>, but is now #<BigDecimal:a5f4a60,'0.15E1',18(18)>
# /tmp/d20130203-23049-10c1ple/spec.rb:16: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) ExchangeRate#set sets the exchange rate in both directions
Failure/Error: rate.get(:EUR, :BGN).should eq '1.25'.to_d
expected: #<BigDecimal:a4f9d40,'0.125E1',18(18)>
got: #<BigDecimal:a72d544,'0.2E1',9(36)>
(compared using ==)
# /tmp/d20130203-23049-10c1ple/spec.rb:25: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) Money arithmetic + with numeric objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<NoMethodError: undefined method `currency' for 42:Fixnum>
# /tmp/d20130203-23049-10c1ple/spec.rb:137:in `block (4 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) Money arithmetic - with numeric objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<NoMethodError: undefined method `currency' for 42:Fixnum>
# /tmp/d20130203-23049-10c1ple/spec.rb:137:in `block (4 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) Money arithmetic + with other objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<NoMethodError: undefined method `currency' for "foobar":String>
# /tmp/d20130203-23049-10c1ple/spec.rb:160:in `block (4 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) Money arithmetic - with other objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<NoMethodError: undefined method `currency' for "foobar":String>
# /tmp/d20130203-23049-10c1ple/spec.rb:160:in `block (4 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) Money comparison with == raises ArgumentError when comparing with other objects
Failure/Error: expect do
expected ArgumentError but nothing was raised
# /tmp/d20130203-23049-10c1ple/spec.rb:195:in `block (4 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) Money comparison with == raises IncompatibleCurrencies when currencies differ
Failure/Error: expect do
expected Money::IncompatibleCurrencies but nothing was raised
# /tmp/d20130203-23049-10c1ple/spec.rb:201:in `block (4 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.05786 seconds
47 examples, 8 failures
Failed examples:
rspec /tmp/d20130203-23049-10c1ple/spec.rb:13 # ExchangeRate#set allows rates to be updated if called multiple times
rspec /tmp/d20130203-23049-10c1ple/spec.rb:21 # ExchangeRate#set sets the exchange rate in both directions
rspec /tmp/d20130203-23049-10c1ple/spec.rb:136 # Money arithmetic + with numeric objects raises an ArgumentError
rspec /tmp/d20130203-23049-10c1ple/spec.rb:136 # Money arithmetic - with numeric objects raises an ArgumentError
rspec /tmp/d20130203-23049-10c1ple/spec.rb:159 # Money arithmetic + with other objects raises an ArgumentError
rspec /tmp/d20130203-23049-10c1ple/spec.rb:159 # Money arithmetic - with other objects raises an ArgumentError
rspec /tmp/d20130203-23049-10c1ple/spec.rb:194 # Money comparison with == raises ArgumentError when comparing with other objects
rspec /tmp/d20130203-23049-10c1ple/spec.rb:200 # Money comparison with == raises IncompatibleCurrencies when currencies differ
История (4 версии и 0 коментара)
Гергана обнови решението на 16.01.2013 10:52 (преди около 12 години)
Гергана обнови решението на 16.01.2013 11:59 (преди около 12 години)
Гергана обнови решението на 16.01.2013 12:01 (преди около 12 години)
Гергана обнови решението на 16.01.2013 12:28 (преди около 12 години)