Решение на Втора задача от Цветан Коев
Обратно към всички решения
Към профила на Цветан Коев
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 11 успешни тест(а)
- 11 неуспешни тест(а)
Код
Лог от изпълнението
F....FFFFF.FFFFF......
Failures:
1) TodoList filters tasks by status
Failure/Error: ]
expected collection contained: ["Do the 5th Ruby challenge.", "Have some tea."]
actual collection contained: []
the missing elements were: ["Do the 5th Ruby challenge.", "Have some tea."]
# /tmp/d20131107-4393-k90xjb/spec.rb:22: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 supports a conjuction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:todo) & Criteria.priority(:high)
NoMethodError:
undefined method `&' for #<Criteria:0xba41ac0c>
# /tmp/d20131107-4393-k90xjb/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)>'
3) TodoList supports a disjunction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:done) | Criteria.priority(:low)
NoMethodError:
undefined method `|' for #<Criteria:0xba418100>
# /tmp/d20131107-4393-k90xjb/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)>'
4) TodoList supports a negation of filters
Failure/Error: filtered = todo_list.filter !Criteria.status(:todo)
NoMethodError:
undefined method `check?' for false:FalseClass
# /tmp/d20131107-4393-k90xjb/solution.rb:82:in `block in filter'
# /tmp/d20131107-4393-k90xjb/solution.rb:82:in `select'
# /tmp/d20131107-4393-k90xjb/solution.rb:82:in `filter'
# /tmp/d20131107-4393-k90xjb/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)>'
5) TodoList supports simple filters combination
Failure/Error: filtered = todo_list.filter Criteria.priority(:high) & !Criteria.tags(['development'])
NoMethodError:
undefined method `&' for #<Criteria:0xba40dd54>
# /tmp/d20131107-4393-k90xjb/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)>'
6) TodoList supports complex filters combination
Failure/Error: Criteria.priority(:high) |
NoMethodError:
undefined method `&' for #<Criteria:0xba47df00>
# /tmp/d20131107-4393-k90xjb/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)>'
7) 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-k90xjb/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)>'
8) TodoList returns the number of the tasks todo
Failure/Error: todo_list.tasks_todo.should eq 5
expected: 5
got: 0
(compared using ==)
# /tmp/d20131107-4393-k90xjb/spec.rb:119: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 returns the number of the tasks in progress
Failure/Error: todo_list.tasks_in_progress.should eq 2
expected: 2
got: 0
(compared using ==)
# /tmp/d20131107-4393-k90xjb/spec.rb:123: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 returns the number of the completed tasks
Failure/Error: todo_list.tasks_completed.should eq 2
expected: 2
got: 0
(compared using ==)
# /tmp/d20131107-4393-k90xjb/spec.rb:127: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)>'
11) TodoList checks if all tasks are completed
Failure/Error: todo_list.completed?.should eq false
expected: false
got: true
(compared using ==)
# /tmp/d20131107-4393-k90xjb/spec.rb:131: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.08943 seconds
22 examples, 11 failures
Failed examples:
rspec /tmp/d20131107-4393-k90xjb/spec.rb:18 # TodoList filters tasks by status
rspec /tmp/d20131107-4393-k90xjb/spec.rb:50 # TodoList supports a conjuction of filters
rspec /tmp/d20131107-4393-k90xjb/spec.rb:55 # TodoList supports a disjunction of filters
rspec /tmp/d20131107-4393-k90xjb/spec.rb:65 # TodoList supports a negation of filters
rspec /tmp/d20131107-4393-k90xjb/spec.rb:75 # TodoList supports simple filters combination
rspec /tmp/d20131107-4393-k90xjb/spec.rb:80 # TodoList supports complex filters combination
rspec /tmp/d20131107-4393-k90xjb/spec.rb:109 # TodoList constructs an object for each task
rspec /tmp/d20131107-4393-k90xjb/spec.rb:118 # TodoList returns the number of the tasks todo
rspec /tmp/d20131107-4393-k90xjb/spec.rb:122 # TodoList returns the number of the tasks in progress
rspec /tmp/d20131107-4393-k90xjb/spec.rb:126 # TodoList returns the number of the completed tasks
rspec /tmp/d20131107-4393-k90xjb/spec.rb:130 # TodoList checks if all tasks are completed
История (1 версия и 0 коментара)
Цветан обнови решението на 06.11.2013 05:41 (преди около 11 години)