Решение на Втора задача от Иван Латунов
Обратно към всички решения
Към профила на Иван Латунов
Резултати
- 2 точки от тестове
- 0 бонус точки
- 2 точки общо
- 6 успешни тест(а)
- 16 неуспешни тест(а)
Код
Лог от изпълнението
..FFFFFFFFF...FFFFFFF.
Failures:
1) TodoList filters tasks by tag
Failure/Error: todo_list.filter(Criteria.tags %w[food]).map(&:description).should =~ ['Eat spaghetti.']
expected collection contained: ["Eat spaghetti."]
actual collection contained: []
the missing elements were: ["Eat spaghetti."]
# /tmp/d20131107-4393-sjc7xf/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: ]
expected collection contained: ["Do the 5th Ruby challenge.", "Grok Ruby."]
actual collection contained: []
the missing elements were: ["Do the 5th Ruby challenge.", "Grok Ruby."]
# /tmp/d20131107-4393-sjc7xf/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)>'
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.']
expected collection contained: ["Do the 5th Ruby challenge."]
actual collection contained: []
the missing elements were: ["Do the 5th Ruby challenge."]
# /tmp/d20131107-4393-sjc7xf/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 #<Proc:0xba3ebe0c@/tmp/d20131107-4393-sjc7xf/solution.rb:90>
# /tmp/d20131107-4393-sjc7xf/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 #<Proc:0xba3e8cac@/tmp/d20131107-4393-sjc7xf/solution.rb:90>
# /tmp/d20131107-4393-sjc7xf/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 `call' for false:FalseClass
# /tmp/d20131107-4393-sjc7xf/solution.rb:52:in `block in filter'
# /tmp/d20131107-4393-sjc7xf/solution.rb:52:in `select'
# /tmp/d20131107-4393-sjc7xf/solution.rb:52:in `filter'
# /tmp/d20131107-4393-sjc7xf/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'])
NoMethodError:
undefined method `&' for #<Proc:0xba45c904@/tmp/d20131107-4393-sjc7xf/solution.rb:94>
# /tmp/d20131107-4393-sjc7xf/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 #<Proc:0xba412a84@/tmp/d20131107-4393-sjc7xf/solution.rb:90>
# /tmp/d20131107-4393-sjc7xf/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: adjoined = development.adjoin food
NoMethodError:
undefined method `adjoin' for []:Array
# /tmp/d20131107-4393-sjc7xf/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)>'
10) TodoList returns the number of the completed tasks
Failure/Error: todo_list.tasks_completed.should eq 2
NoMethodError:
undefined method `tasks_completed' for #<TodoList:0xba2d24a8>
# /tmp/d20131107-4393-sjc7xf/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.filter(Criteria.status :done).completed?.should eq true
NoMethodError:
undefined method `completed?' for #<Array:0xba2d0428>
# /tmp/d20131107-4393-sjc7xf/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)>'
12) TodoList doesn't modify the to-do list when filtering
Failure/Error: todo_list.should have(text_input.lines.count).items
NoMethodError:
undefined method `items' for #<TodoList:0xba2ca514>
# /tmp/d20131107-4393-sjc7xf/spec.rb:137: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 implements Enumerable
Failure/Error: todo_list.should be_an Enumerable
expected #<TodoList:0xba2be034 @array=[#<TodoItem:0xba2bef98 @status="TODO", @description="Eat spaghetti.", @priority="High", @tags=["food", " happiness"]>, #<TodoItem:0xba2bed90 @status="TODO", @description="Get 8 hours of sleep.", @priority="Low", @tags=["health"]>, #<TodoItem:0xba2beb9c @status="CURRENT", @description="Party animal.", @priority="Normal", @tags=["socialization"]>, #<TodoItem:0xba2bea0c @status="CURRENT", @description="Grok Ruby.", @priority="High", @tags=["development", " ruby"]>, #<TodoItem:0xba2be804 @status="DONE", @description="Have some tea.", @priority="Normal", @tags=nil>, #<TodoItem:0xba2be6ec @status="TODO", @description="Destroy Facebook and Google.", @priority="High", @tags=["save humanity", " conspiracy"]>, #<TodoItem:0xba2be548 @status="DONE", @description="Do the 5th Ruby challenge.", @priority="High", @tags=["ruby course", " FMI", " development", " ruby"]>, #<TodoItem:0xba2be368 @status="TODO", @description="Find missing socks.", @priority="Low", @tags=nil>, #<TodoItem:0xba2be250 @status="TODO", @description="Occupy Sofia University.", @priority="High", @tags=["#ДАНСwithMe", " #occupysu", " #оставка"]>]> to be a kind of Enumerable
# /tmp/d20131107-4393-sjc7xf/spec.rb:142: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 contains tasks with the neccessary interface
Failure/Error: task = todo_list.first
NoMethodError:
undefined method `first' for #<TodoList:0xba2b36e8>
# /tmp/d20131107-4393-sjc7xf/spec.rb:146: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 tasks have an array of tags
Failure/Error: todo_list.first.tags.should be_an Array
NoMethodError:
undefined method `first' for #<TodoList:0xba2b1140>
# /tmp/d20131107-4393-sjc7xf/spec.rb:155: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)>'
16) TodoList preserves the order of tasks
Failure/Error: todo_list.map(&:description).should eq [
NoMethodError:
undefined method `map' for #<TodoList:0xba2aa4d0>
# /tmp/d20131107-4393-sjc7xf/spec.rb:159: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.03814 seconds
22 examples, 16 failures
Failed examples:
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:35 # TodoList filters tasks by tag
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:39 # TodoList filters tasks by multiple tags
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:46 # TodoList filtering by multiple tags matches only tasks with all the tags
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:50 # TodoList supports a conjuction of filters
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:55 # TodoList supports a disjunction of filters
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:65 # TodoList supports a negation of filters
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:75 # TodoList supports simple filters combination
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:80 # TodoList supports complex filters combination
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:96 # TodoList can be adjoined with another to-do list
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:126 # TodoList returns the number of the completed tasks
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:130 # TodoList checks if all tasks are completed
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:135 # TodoList doesn't modify the to-do list when filtering
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:140 # TodoList implements Enumerable
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:145 # TodoList contains tasks with the neccessary interface
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:154 # TodoList tasks have an array of tags
rspec /tmp/d20131107-4393-sjc7xf/spec.rb:158 # TodoList preserves the order of tasks
История (4 версии и 0 коментара)
Иван обнови решението на 06.11.2013 15:20 (преди около 11 години)
Иван обнови решението на 06.11.2013 16:57 (преди около 11 години)
Иван обнови решението на 06.11.2013 17:13 (преди около 11 години)
Иван обнови решението на 06.11.2013 17:25 (преди около 11 години)