Решение на Втора задача от Илия Тобов
Обратно към всички решения
Към профила на Илия Тобов
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 11 успешни тест(а)
- 11 неуспешни тест(а)
Код
Лог от изпълнението
..FFFFFFFFFF.........F
Failures:
1) TodoList filters tasks by tag
Failure/Error: todo_list.filter(Criteria.tags %w[food]).map(&:description).should =~ ['Eat spaghetti.']
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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)>'
2) TodoList filters tasks by multiple tags
Failure/Error: todo_list.filter(Criteria.tags %w[development ruby]).map(&:description).should =~ [
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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)>'
3) 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.']
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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)>'
4) TodoList supports a conjuction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:todo) & Criteria.priority(:high)
NoMethodError:
undefined method `&' for #<AttributeMatch:0xb8d673e8 @attribute=:status, @value=:todo>
# /tmp/d20131107-4393-19cu0ze/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)>'
5) TodoList supports a disjunction of filters
Failure/Error: filtered = todo_list.filter Criteria.status(:done) | Criteria.priority(:low)
NoMethodError:
undefined method `|' for #<AttributeMatch:0xb8d65228 @attribute=:status, @value=:done>
# /tmp/d20131107-4393-19cu0ze/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)>'
6) TodoList supports a negation of filters
Failure/Error: filtered = todo_list.filter !Criteria.status(:todo)
NoMethodError:
undefined method `met_by?' for false:FalseClass
# /tmp/d20131107-4393-19cu0ze/solution.rb:23:in `block in filter'
# /tmp/d20131107-4393-19cu0ze/solution.rb:23:in `select'
# /tmp/d20131107-4393-19cu0ze/solution.rb:23:in `filter'
# /tmp/d20131107-4393-19cu0ze/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)>'
7) TodoList supports simple filters combination
Failure/Error: filtered = todo_list.filter Criteria.priority(:high) & !Criteria.tags(['development'])
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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)>'
8) TodoList supports complex filters combination
Failure/Error: Criteria.priority(:high) |
NoMethodError:
undefined method `&' for #<AttributeMatch:0xb8b448e0 @attribute=:status, @value=:todo>
# /tmp/d20131107-4393-19cu0ze/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)>'
9) TodoList can be adjoined with another to-do list
Failure/Error: development = todo_list.filter Criteria.tags(['development'])
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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)>'
10) TodoList constructs an object for each task
Failure/Error: task = todo_list.filter(Criteria.tags ['health']).first
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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)>'
11) TodoList creates a new object on filter
Failure/Error: todo_list.filter(Criteria.tags %w[wtf]).should_not equal todo_list
NameError:
uninitialized constant Criteria::TagsMatch
# /tmp/d20131107-4393-19cu0ze/solution.rb:86:in `tags'
# /tmp/d20131107-4393-19cu0ze/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.10113 seconds
22 examples, 11 failures
Failed examples:
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:35 # TodoList filters tasks by tag
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:39 # TodoList filters tasks by multiple tags
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:46 # TodoList filtering by multiple tags matches only tasks with all the tags
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:50 # TodoList supports a conjuction of filters
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:55 # TodoList supports a disjunction of filters
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:65 # TodoList supports a negation of filters
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:75 # TodoList supports simple filters combination
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:80 # TodoList supports complex filters combination
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:96 # TodoList can be adjoined with another to-do list
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:109 # TodoList constructs an object for each task
rspec /tmp/d20131107-4393-19cu0ze/spec.rb:172 # TodoList creates a new object on filter
История (1 версия и 0 коментара)
Илия обнови решението на 06.11.2013 16:47 (преди около 11 години)