Решение на Втора задача от Антонио Николов
Обратно към всички решения
Към профила на Антонио Николов
Резултати
- 2 точки от тестове
- 0 бонус точки
- 2 точки общо
- 7 успешни тест(а)
- 15 неуспешни тест(а)
Код
Лог от изпълнението
FFFFFFFFFFFF...FF....F
Failures:
1) TodoList filters tasks by status
Failure/Error: todo_list.filter(Criteria.status :done).map(&:description).should =~ [
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb94e9bd4>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:19: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 filters tasks by priority
Failure/Error: todo_list.filter(Criteria.priority :high).map(&:description).should =~ [
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb94e717c>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:26: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 filters tasks by tag
Failure/Error: todo_list.filter(Criteria.tags %w[food]).map(&:description).should =~ ['Eat spaghetti.']
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb94e4d78>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:36: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 filters tasks by multiple tags
Failure/Error: todo_list.filter(Criteria.tags %w[development ruby]).map(&:description).should =~ [
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb9476b98>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:40: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 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.']
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb947476c>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/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)>'
6) TodoList supports a conjuction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:todo) & Criteria.priority(:high)
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb9464808>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/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)>'
7) TodoList supports a disjunction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:done) | Criteria.priority(:low)
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb94ddfa0>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/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)>'
8) TodoList supports a negation of filters
Failure/Error: filtered = todo_list.filter !Criteria.status(:todo)
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb9493c20>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/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)>'
9) TodoList supports simple filters combination
Failure/Error: filtered = todo_list.filter Criteria.priority(:high) & !Criteria.tags(['development'])
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb94914d4>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/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)>'
10) TodoList supports complex filters combination
Failure/Error: filtered = todo_list.filter Criteria.status(:todo) &
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb935de50>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:81: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 can be adjoined with another to-do list
Failure/Error: development = todo_list.filter Criteria.tags(['development'])
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb935b3a8>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:97: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)>'
12) TodoList constructs an object for each task
Failure/Error: task = todo_list.filter(Criteria.tags ['health']).first
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb93590bc>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:110: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)>'
13) TodoList checks if all tasks are completed
Failure/Error: todo_list.filter(Criteria.status :done).completed?.should eq true
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb934619c>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/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)>'
14) TodoList doesn't modify the to-do list when filtering
Failure/Error: todo_list.filter(Criteria.status :todo)
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb9343b40>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:136: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)>'
15) TodoList creates a new object on filter
Failure/Error: todo_list.filter(Criteria.tags %w[wtf]).should_not equal todo_list
NoMethodError:
undefined method `filter_tasks' for #<TodoList:0xb9327f94>
# /tmp/d20131107-4393-18purgj/solution.rb:97:in `block in filter'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `call'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `block in each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:80:in `each'
# /tmp/d20131107-4393-18purgj/solution.rb:96:in `filter'
# /tmp/d20131107-4393-18purgj/spec.rb:173: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.03587 seconds
22 examples, 15 failures
Failed examples:
rspec /tmp/d20131107-4393-18purgj/spec.rb:18 # TodoList filters tasks by status
rspec /tmp/d20131107-4393-18purgj/spec.rb:25 # TodoList filters tasks by priority
rspec /tmp/d20131107-4393-18purgj/spec.rb:35 # TodoList filters tasks by tag
rspec /tmp/d20131107-4393-18purgj/spec.rb:39 # TodoList filters tasks by multiple tags
rspec /tmp/d20131107-4393-18purgj/spec.rb:46 # TodoList filtering by multiple tags matches only tasks with all the tags
rspec /tmp/d20131107-4393-18purgj/spec.rb:50 # TodoList supports a conjuction of filters
rspec /tmp/d20131107-4393-18purgj/spec.rb:55 # TodoList supports a disjunction of filters
rspec /tmp/d20131107-4393-18purgj/spec.rb:65 # TodoList supports a negation of filters
rspec /tmp/d20131107-4393-18purgj/spec.rb:75 # TodoList supports simple filters combination
rspec /tmp/d20131107-4393-18purgj/spec.rb:80 # TodoList supports complex filters combination
rspec /tmp/d20131107-4393-18purgj/spec.rb:96 # TodoList can be adjoined with another to-do list
rspec /tmp/d20131107-4393-18purgj/spec.rb:109 # TodoList constructs an object for each task
rspec /tmp/d20131107-4393-18purgj/spec.rb:130 # TodoList checks if all tasks are completed
rspec /tmp/d20131107-4393-18purgj/spec.rb:135 # TodoList doesn't modify the to-do list when filtering
rspec /tmp/d20131107-4393-18purgj/spec.rb:172 # TodoList creates a new object on filter
История (1 версия и 0 коментара)
Антонио обнови решението на 06.11.2013 17:27 (преди около 11 години)