Решение на Втора задача от Михаил Илиев
Обратно към всички решения
Към профила на Михаил Илиев
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 8 успешни тест(а)
- 4 неуспешни тест(а)
Код
Лог от изпълнението
.....FF..FF.
Failures:
1) Collection can find songs by multiple tags
Failure/Error: collection.find(options)
NoMethodError:
undefined method `split' for ["popular", "violin"]:Array
# /tmp/d20111115-13548-g84nr9/solution.rb:23:in `block (2 levels) in find'
# /tmp/d20111115-13548-g84nr9/solution.rb:21:in `select'
# /tmp/d20111115-13548-g84nr9/solution.rb:21:in `block in find'
# /tmp/d20111115-13548-g84nr9/solution.rb:18:in `each'
# /tmp/d20111115-13548-g84nr9/solution.rb:18:in `find'
# /tmp/d20111115-13548-g84nr9/spec.rb:96:in `songs'
# /tmp/d20111115-13548-g84nr9/spec.rb:57: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)>'
2) Collection can find songs that don't have a tag
Failure/Error: collection.find(options)
NoMethodError:
undefined method `split' for ["weird", "cool!"]:Array
# /tmp/d20111115-13548-g84nr9/solution.rb:23:in `block (2 levels) in find'
# /tmp/d20111115-13548-g84nr9/solution.rb:21:in `select'
# /tmp/d20111115-13548-g84nr9/solution.rb:21:in `block in find'
# /tmp/d20111115-13548-g84nr9/solution.rb:18:in `each'
# /tmp/d20111115-13548-g84nr9/solution.rb:18:in `find'
# /tmp/d20111115-13548-g84nr9/spec.rb:96:in `songs'
# /tmp/d20111115-13548-g84nr9/spec.rb:61: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) Collection allows multiple criteria
Failure/Error: songs(name: "'Round Midnight", tags: 'bebop').map(&:artist).should eq ['Thelonious Monk']
expected: ["Thelonious Monk"]
got: ["John Coltrane", "John Coltrane", "Miles Davis", "Thelonious Monk"]
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-["Thelonious Monk"]
+["John Coltrane", "John Coltrane", "Miles Davis", "Thelonious Monk"]
# /tmp/d20111115-13548-g84nr9/spec.rb:73: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)>'
4) Collection allows all criteria
Failure/Error: ).map(&:artist).should eq ['Thelonious Monk']
expected: ["Thelonious Monk"]
got: ["John Coltrane", "John Coltrane", "John Coltrane", "John Coltrane", "John Coltrane", "John Coltrane", "Miles Davis", "Miles Davis", "Miles Davis", "Miles Davis", "Bill Evans", "Bill Evans", "Thelonious Monk", "Thelonious Monk"]
(compared using ==)
Diff:
@@ -1,2 +1,15 @@
-["Thelonious Monk"]
+["John Coltrane",
+ "John Coltrane",
+ "John Coltrane",
+ "John Coltrane",
+ "John Coltrane",
+ "John Coltrane",
+ "Miles Davis",
+ "Miles Davis",
+ "Miles Davis",
+ "Miles Davis",
+ "Bill Evans",
+ "Bill Evans",
+ "Thelonious Monk",
+ "Thelonious Monk"]
# /tmp/d20111115-13548-g84nr9/spec.rb:82: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)>'
Finished in 0.54993 seconds
12 examples, 4 failures
Failed examples:
rspec /tmp/d20111115-13548-g84nr9/spec.rb:56 # Collection can find songs by multiple tags
rspec /tmp/d20111115-13548-g84nr9/spec.rb:60 # Collection can find songs that don't have a tag
rspec /tmp/d20111115-13548-g84nr9/spec.rb:72 # Collection allows multiple criteria
rspec /tmp/d20111115-13548-g84nr9/spec.rb:76 # Collection allows all criteria
История (1 версия и 0 коментара)
Михаил обнови решението на 31.10.2011 15:56 (преди около 13 години)