Решение на Втора задача от Станимир Килявков
Обратно към всички решения
Към профила на Станимир Килявков
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 10 успешни тест(а)
- 12 неуспешни тест(а)
Код
Лог от изпълнението
...FFFFFFF.FFFFF......
Failures:
1) 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-tvrkle/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: []
the missing elements were: ["Do the 5th Ruby challenge."]
# /tmp/d20131107-4393-tvrkle/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.map(&:description).should =~ ['Eat spaghetti.', 'Destroy Facebook and Google.', 'Occupy Sofia University.']
expected collection contained: ["Destroy Facebook and Google.", "Eat spaghetti.", "Occupy Sofia University."]
actual collection contained: []
the missing elements were: ["Destroy Facebook and Google.", "Eat spaghetti.", "Occupy Sofia University."]
# /tmp/d20131107-4393-tvrkle/spec.rb:52: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 "DONE":String
# /tmp/d20131107-4393-tvrkle/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: ]
expected collection contained: ["Do the 5th Ruby challenge.", "Grok Ruby.", "Have some tea.", "Party animal."]
actual collection contained: []
the missing elements were: ["Do the 5th Ruby challenge.", "Grok Ruby.", "Have some tea.", "Party animal."]
# /tmp/d20131107-4393-tvrkle/spec.rb:72: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 "High":String
# /tmp/d20131107-4393-tvrkle/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.tags(['development'])
NoMethodError:
undefined method `&' for "Normal":String
# /tmp/d20131107-4393-tvrkle/spec.rb:84: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 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-tvrkle/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)>'
9) TodoList returns the number of the tasks todo
Failure/Error: todo_list.tasks_todo.should eq 5
NoMethodError:
undefined method `tasks_todo' for #<Array:0xb9c6d8d8>
# /tmp/d20131107-4393-tvrkle/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)>'
10) TodoList returns the number of the tasks in progress
Failure/Error: todo_list.tasks_in_progress.should eq 2
NoMethodError:
undefined method `tasks_in_progress' for #<Array:0xb9c6b45c>
# /tmp/d20131107-4393-tvrkle/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)>'
11) TodoList returns the number of the completed tasks
Failure/Error: todo_list.tasks_completed.should eq 2
NoMethodError:
undefined method `tasks_completed' for #<Array:0xb9c69224>
# /tmp/d20131107-4393-tvrkle/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)>'
12) TodoList checks if all tasks are completed
Failure/Error: todo_list.completed?.should eq false
NoMethodError:
undefined method `completed?' for #<Array:0xb9c62cbc>
# /tmp/d20131107-4393-tvrkle/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.03967 seconds
22 examples, 12 failures
Failed examples:
rspec /tmp/d20131107-4393-tvrkle/spec.rb:39 # TodoList filters tasks by multiple tags
rspec /tmp/d20131107-4393-tvrkle/spec.rb:46 # TodoList filtering by multiple tags matches only tasks with all the tags
rspec /tmp/d20131107-4393-tvrkle/spec.rb:50 # TodoList supports a conjuction of filters
rspec /tmp/d20131107-4393-tvrkle/spec.rb:55 # TodoList supports a disjunction of filters
rspec /tmp/d20131107-4393-tvrkle/spec.rb:65 # TodoList supports a negation of filters
rspec /tmp/d20131107-4393-tvrkle/spec.rb:75 # TodoList supports simple filters combination
rspec /tmp/d20131107-4393-tvrkle/spec.rb:80 # TodoList supports complex filters combination
rspec /tmp/d20131107-4393-tvrkle/spec.rb:109 # TodoList constructs an object for each task
rspec /tmp/d20131107-4393-tvrkle/spec.rb:118 # TodoList returns the number of the tasks todo
rspec /tmp/d20131107-4393-tvrkle/spec.rb:122 # TodoList returns the number of the tasks in progress
rspec /tmp/d20131107-4393-tvrkle/spec.rb:126 # TodoList returns the number of the completed tasks
rspec /tmp/d20131107-4393-tvrkle/spec.rb:130 # TodoList checks if all tasks are completed
История (1 версия и 0 коментара)
Станимир обнови решението на 06.11.2013 08:43 (преди около 11 години)