Решение на Шеста задача от Цвета Гергичанова
Обратно към всички решения
Към профила на Цвета Гергичанова
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 31 успешни тест(а)
- 16 неуспешни тест(а)
Код
Лог от изпълнението
.........F.....F..F.F.F..F..F..FF...FFF.F.F.F.F
Failures:
1) ExchangeRate#convert raises an ExchangeRate::Unknown exception when the rate is not defined
Failure/Error: end.to raise_error(ExchangeRate::Unknown)
NameError:
uninitialized constant ExchangeRate::Unknown
# /tmp/d20130203-23049-96rq71/spec.rb:58: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) Money has a custom to_s representation
Failure/Error: Money.new('12.1'.to_d, :USD).to_s.should eq '12.10 USD'
expected: "12.10 USD"
got: "12.1 USD"
(compared using ==)
# /tmp/d20130203-23049-96rq71/spec.rb:90:in `block (2 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 convertion raises an ExchangeRate::Unknown exception for unknown rates
Failure/Error: end.to raise_error(ExchangeRate::Unknown)
NameError:
uninitialized constant ExchangeRate::Unknown
# /tmp/d20130203-23049-96rq71/spec.rb:113: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) Money arithmetic * with money objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<TypeError: Money can't be coerced into BigDecimal>
# /tmp/d20130203-23049-96rq71/spec.rb:129: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 money objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<TypeError: Money can't be coerced into BigDecimal>
# /tmp/d20130203-23049-96rq71/spec.rb:129: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 raises Money::IncompatibleCurrencies for + with money with different currencies
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:154: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 arithmetic raises Money::IncompatibleCurrencies for - with money with different currencies
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:154: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 arithmetic * with other objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<TypeError: String can't be coerced into BigDecimal>
# /tmp/d20130203-23049-96rq71/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)>'
9) Money arithmetic / with other objects raises an ArgumentError
Failure/Error: expect do
expected ArgumentError, got #<TypeError: String can't be coerced into BigDecimal>
# /tmp/d20130203-23049-96rq71/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)>'
10) Money comparison with <=> raises IncompatibleCurrencies when currencies differ
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:203: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)>'
11) Money comparison with == raises ArgumentError when comparing with other objects
Failure/Error: expect do
expected ArgumentError but nothing was raised
# /tmp/d20130203-23049-96rq71/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)>'
12) Money comparison with == raises IncompatibleCurrencies when currencies differ
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:203: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)>'
13) Money comparison with < raises IncompatibleCurrencies when currencies differ
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:203: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)>'
14) Money comparison with <= raises IncompatibleCurrencies when currencies differ
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:203: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)>'
15) Money comparison with > raises IncompatibleCurrencies when currencies differ
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:203: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)>'
16) Money comparison with >= raises IncompatibleCurrencies when currencies differ
Failure/Error: end.to raise_error(Money::IncompatibleCurrencies)
NameError:
uninitialized constant Money::IncompatibleCurrencies
# /tmp/d20130203-23049-96rq71/spec.rb:203: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.06827 seconds
47 examples, 16 failures
Failed examples:
rspec /tmp/d20130203-23049-96rq71/spec.rb:55 # ExchangeRate#convert raises an ExchangeRate::Unknown exception when the rate is not defined
rspec /tmp/d20130203-23049-96rq71/spec.rb:88 # Money has a custom to_s representation
rspec /tmp/d20130203-23049-96rq71/spec.rb:110 # Money convertion raises an ExchangeRate::Unknown exception for unknown rates
rspec /tmp/d20130203-23049-96rq71/spec.rb:128 # Money arithmetic * with money objects raises an ArgumentError
rspec /tmp/d20130203-23049-96rq71/spec.rb:128 # Money arithmetic / with money objects raises an ArgumentError
rspec /tmp/d20130203-23049-96rq71/spec.rb:151 # Money arithmetic raises Money::IncompatibleCurrencies for + with money with different currencies
rspec /tmp/d20130203-23049-96rq71/spec.rb:151 # Money arithmetic raises Money::IncompatibleCurrencies for - with money with different currencies
rspec /tmp/d20130203-23049-96rq71/spec.rb:159 # Money arithmetic * with other objects raises an ArgumentError
rspec /tmp/d20130203-23049-96rq71/spec.rb:159 # Money arithmetic / with other objects raises an ArgumentError
rspec /tmp/d20130203-23049-96rq71/spec.rb:200 # Money comparison with <=> raises IncompatibleCurrencies when currencies differ
rspec /tmp/d20130203-23049-96rq71/spec.rb:194 # Money comparison with == raises ArgumentError when comparing with other objects
rspec /tmp/d20130203-23049-96rq71/spec.rb:200 # Money comparison with == raises IncompatibleCurrencies when currencies differ
rspec /tmp/d20130203-23049-96rq71/spec.rb:200 # Money comparison with < raises IncompatibleCurrencies when currencies differ
rspec /tmp/d20130203-23049-96rq71/spec.rb:200 # Money comparison with <= raises IncompatibleCurrencies when currencies differ
rspec /tmp/d20130203-23049-96rq71/spec.rb:200 # Money comparison with > raises IncompatibleCurrencies when currencies differ
rspec /tmp/d20130203-23049-96rq71/spec.rb:200 # Money comparison with >= raises IncompatibleCurrencies when currencies differ
История (2 версии и 0 коментара)
Цвета обнови решението на 16.01.2013 12:57 (преди около 12 години)
Цвета обнови решението на 16.01.2013 13:23 (преди около 12 години)