Решение на Втора задача - хешове, масиви и структура от Симеон Гергинов
Обратно към всички решения
Към профила на Симеон Гергинов
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 9 успешни тест(а)
- 6 неуспешни тест(а)
Код
Лог от изпълнението
F....F.F.FF.F..
Failures:
1) Task 2 README works for all examples
Failure/Error: expect(dessert.fetch_deep('variant')).to eq('chocolate')
expected: "chocolate"
got: nil
(compared using ==)
# /tmp/d20161024-13689-wcqm02/spec.rb:25:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
2) Task 2 Hash#fetch_deep is indifferent to symbols and strings
Failure/Error: expect(input.fetch_deep('dessert')).to eq 'ice cream'
expected: "ice cream"
got: nil
(compared using ==)
# /tmp/d20161024-13689-wcqm02/spec.rb:96:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
3) Task 2 Hash#fetch_deep can fetch integer-like keys from hashes
Failure/Error: expect(input.fetch_deep('nested.1')).to eq :a
expected: :a
got: nil
(compared using ==)
# /tmp/d20161024-13689-wcqm02/spec.rb:111:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
4) Task 2 Hash#reshape can extract fields to nested objects
Failure/Error: expect(input.reshape(shape)).to eq output
expected: {:me=>{:first_name=>"Georgi"}}
got: {:me=>{:first_name=>"profile.name"}}
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-:me => {:first_name=>"Georgi"}
+:me => {:first_name=>"profile.name"}
# /tmp/d20161024-13689-wcqm02/spec.rb:133:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
5) Task 2 Hash#reshape can create nested objects
Failure/Error: expect(input.reshape(shape)).to eq output
expected: {:profile=>{:first_name=>"Georgi"}}
got: {:profile=>{:first_name=>"name"}}
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-:profile => {:first_name=>"Georgi"}
+:profile => {:first_name=>"name"}
# /tmp/d20161024-13689-wcqm02/spec.rb:146:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
6) Task 2 Hash#reshape can extract fields from arrays by index
Failure/Error: expect(input.reshape(shape)).to eq output
expected: {:me=>{:first_name=>"Georgi", :second_name=>"Ivan"}}
got: {:me=>{:first_name=>"users.0.name", :second_name=>"users.1.name"}}
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-:me => {:first_name=>"Georgi", :second_name=>"Ivan"}
+:me => {:first_name=>"users.0.name", :second_name=>"users.1.name"}
# /tmp/d20161024-13689-wcqm02/spec.rb:177:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
Finished in 0.00959 seconds
15 examples, 6 failures
Failed examples:
rspec /tmp/d20161024-13689-wcqm02/spec.rb:3 # Task 2 README works for all examples
rspec /tmp/d20161024-13689-wcqm02/spec.rb:92 # Task 2 Hash#fetch_deep is indifferent to symbols and strings
rspec /tmp/d20161024-13689-wcqm02/spec.rb:108 # Task 2 Hash#fetch_deep can fetch integer-like keys from hashes
rspec /tmp/d20161024-13689-wcqm02/spec.rb:125 # Task 2 Hash#reshape can extract fields to nested objects
rspec /tmp/d20161024-13689-wcqm02/spec.rb:136 # Task 2 Hash#reshape can create nested objects
rspec /tmp/d20161024-13689-wcqm02/spec.rb:156 # Task 2 Hash#reshape can extract fields from arrays by index
История (5 версии и 6 коментара)
Симеон обнови решението на 19.10.2016 23:42 (преди около 8 години)
Симеон обнови решението на 20.10.2016 17:06 (преди около 8 години)
Симеон обнови решението на 20.10.2016 22:52 (преди около 8 години)
Симеон обнови решението на 21.10.2016 10:12 (преди около 8 години)
Симеон обнови решението на 22.10.2016 14:43 (преди около 8 години)