Решение на Втора задача от Елена Орешарова
Обратно към всички решения
Към профила на Елена Орешарова
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 12 успешни тест(а)
- 10 неуспешни тест(а)
Код
Лог от изпълнението
...FFFFFFFFF...F......
Failures:
1) TodoList filters tasks by multiple tags
Failure/Error: ]
expected collection contained: ["Do the 5th Ruby challenge.", "Grok Ruby."]
actual collection contained: ["Grok Ruby."]
the missing elements were: ["Do the 5th Ruby challenge."]
# /tmp/d20131107-4393-1iabb20/spec.rb:43:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) TodoList filtering by multiple tags matches only tasks with all the tags
Failure/Error: todo_list.filter(Criteria.tags %w[development FMI]).map(&:description).should =~ ['Do the 5th Ruby challenge.']
expected collection contained: ["Do the 5th Ruby challenge."]
actual collection contained: ["Grok Ruby."]
the missing elements were: ["Do the 5th Ruby challenge."]
the extra elements were: ["Grok Ruby."]
# /tmp/d20131107-4393-1iabb20/spec.rb:47:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) TodoList supports a conjuction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:todo) & Criteria.priority(:high)
NoMethodError:
undefined method `&' for #<Criteria:0xb9844f2c @argument=:TODO>
# /tmp/d20131107-4393-1iabb20/spec.rb:51:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) TodoList supports a disjunction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:done) | Criteria.priority(:low)
NoMethodError:
undefined method `|' for #<Criteria:0xb98befd4 @argument=:DONE>
# /tmp/d20131107-4393-1iabb20/spec.rb:56:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) TodoList supports a negation of filters
Failure/Error: filtered = todo_list.filter !Criteria.status(:todo)
NoMethodError:
undefined method `argument' for false:FalseClass
# /tmp/d20131107-4393-1iabb20/solution.rb:45:in `block in filter'
# /tmp/d20131107-4393-1iabb20/solution.rb:44:in `select'
# /tmp/d20131107-4393-1iabb20/solution.rb:44:in `filter'
# /tmp/d20131107-4393-1iabb20/spec.rb:66:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) TodoList supports simple filters combination
Failure/Error: filtered = todo_list.filter Criteria.priority(:high) & !Criteria.tags(['development'])
NoMethodError:
undefined method `&' for #<Criteria:0xb9873c78 @argument=:high>
# /tmp/d20131107-4393-1iabb20/spec.rb:76:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
7) TodoList supports complex filters combination
Failure/Error: Criteria.priority(:high) |
NoMethodError:
undefined method `&' for #<Criteria:0xb98714c8 @argument=:TODO>
# /tmp/d20131107-4393-1iabb20/spec.rb:82:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
8) TodoList can be adjoined with another to-do list
Failure/Error: adjoined = development.adjoin food
NoMethodError:
undefined method `adjoin' for #<Array:0xb97430c4>
# /tmp/d20131107-4393-1iabb20/spec.rb:99:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
9) TodoList constructs an object for each task
Failure/Error: task.status.should eq :todo
expected: :todo
got: :TODO
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-:todo
+:TODO
# /tmp/d20131107-4393-1iabb20/spec.rb:112:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
10) TodoList checks if all tasks are completed
Failure/Error: todo_list.filter(Criteria.status :done).completed?.should eq true
NoMethodError:
undefined method `completed?' for #<Array:0xb972c040>
# /tmp/d20131107-4393-1iabb20/spec.rb:132:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.03794 seconds
22 examples, 10 failures
Failed examples:
rspec /tmp/d20131107-4393-1iabb20/spec.rb:39 # TodoList filters tasks by multiple tags
rspec /tmp/d20131107-4393-1iabb20/spec.rb:46 # TodoList filtering by multiple tags matches only tasks with all the tags
rspec /tmp/d20131107-4393-1iabb20/spec.rb:50 # TodoList supports a conjuction of filters
rspec /tmp/d20131107-4393-1iabb20/spec.rb:55 # TodoList supports a disjunction of filters
rspec /tmp/d20131107-4393-1iabb20/spec.rb:65 # TodoList supports a negation of filters
rspec /tmp/d20131107-4393-1iabb20/spec.rb:75 # TodoList supports simple filters combination
rspec /tmp/d20131107-4393-1iabb20/spec.rb:80 # TodoList supports complex filters combination
rspec /tmp/d20131107-4393-1iabb20/spec.rb:96 # TodoList can be adjoined with another to-do list
rspec /tmp/d20131107-4393-1iabb20/spec.rb:109 # TodoList constructs an object for each task
rspec /tmp/d20131107-4393-1iabb20/spec.rb:130 # TodoList checks if all tasks are completed
История (1 версия и 0 коментара)
Елена обнови решението на 06.11.2013 09:15 (преди около 11 години)