Решение на Втора задача от Йоана Тодорова
Обратно към всички решения
Към профила на Йоана Тодорова
Резултати
- 1 точка от тестове
- 0 бонус точки
- 1 точка общо
- 1 успешни тест(а)
- 10 неуспешни тест(а)
Код
Лог от изпълнението
FFF[#<Song:0x8a9e75c @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x8a9e02c @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x8a9df3c @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8a9df00 @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8a9dd70 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x8a9dc80 @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x8a9db40 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x8a9d974 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x8a9d85c @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x8a9d758 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]F[#<Song:0x8aaaa5c @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x8aaa9e4 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x8aaa994 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8aaa87c @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8aaa728 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x8aaa5d4 @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x8aaa46c @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x8aaa1ec @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x8aa9788 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x8aa9634 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]F[#<Song:0x8ac73a0 @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x8ac7288 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x8ac724c @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8ac70f8 @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8ac6fe0 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x8ac6d88 @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x8ac6cd4 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x8ac6c20 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x8ac6b44 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x8ac6ab8 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]F[#<Song:0x8ace9fc @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x8ace9c0 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x8ace998 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8ace920 @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8ace894 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x8ace858 @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x8ace718 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x8ace68c @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x8ace5ec @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x8ace54c @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">].[#<Song:0x8d0fc98 @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x8d0fc70 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x8d0fc34 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8d0fc0c @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x8d0fbe4 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x8d0fbbc @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x8d0fb80 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x8d0fb58 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x8d0fb30 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x8d0fb08 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]Ftrue
[#<Song:0x9304dc4 @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x9304cfc @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x9304c34 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9304a2c @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x93049f0 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x930489c @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x9304720 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x9304644 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x93044c8 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x930439c @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]F[#<Song:0x9308f14 @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x9308ed8 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x9308e74 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9308e4c @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9308e24 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x9308dfc @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x9308dac @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x9308d70 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x9308d48 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x9308cf8 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]F[#<Song:0x9305fe4 @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x9305fa8 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x9305f58 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9305f1c @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9305ee0 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x9305ea4 @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x9305e68 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x9305e40 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x9305e18 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x9305d78 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">][#<Song:0x9305fe4 @s_name="Fields of Gold", @s_artist="Sting", @s_album="Ten Summoner's Tales">, #<Song:0x9305fa8 @s_name="Mad About You", @s_artist="Sting", @s_album="The Soul Cages">, #<Song:0x9305f58 @s_name="Fields of Gold", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9305f1c @s_name="Autumn Leaves", @s_artist="Eva Cassidy", @s_album="Live at Blues Alley">, #<Song:0x9305ee0 @s_name="Autumn Leaves", @s_artist="Bill Evans", @s_album="Portrait in Jazz">, #<Song:0x9305ea4 @s_name="Brain of J.F.K", @s_artist="Pearl Jam", @s_album="Yield">, #<Song:0x9305e68 @s_name="Jeremy", @s_artist="Pearl Jam", @s_album="Ten">, #<Song:0x9305e40 @s_name="Come Away With Me", @s_artist="Norah Johnes", @s_album="One">, #<Song:0x9305e18 @s_name="Acknowledgment", @s_artist="John Coltrane", @s_album="A Love Supreme">, #<Song:0x9305d78 @s_name="Ruby, My Dear", @s_artist="Thelonious Monk", @s_album="Mysterioso">]F
Failures:
1) Collection can find all the artists in the collection
Failure/Error: collection.artists.should =~ [
NoMethodError:
undefined method `artists' for #<Collection:0x8a724a4>
# /tmp/d20130203-23049-7qlizo/spec.rb:5:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) Collection can find all the names of all songs in the collection
Failure/Error: collection.names.should =~ [
NoMethodError:
undefined method `names' for #<Collection:0x8a8b8dc>
# /tmp/d20130203-23049-7qlizo/spec.rb:17:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) Collection can find all the albums in the collection
Failure/Error: collection.albums.should =~ [
NoMethodError:
undefined method `albums' for #<Collection:0x8a937d0>
# /tmp/d20130203-23049-7qlizo/spec.rb:30:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) Collection can be filtered by song name
Failure/Error: filtered.map(&:artist).should =~ ['Eva Cassidy', 'Sting']
NoMethodError:
undefined method `map' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:45:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) Collection can be filtered by song name
Failure/Error: filtered.map(&:album).should =~ ['The Soul Cages', "Ten Summoner's Tales"]
NoMethodError:
undefined method `map' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:50:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) Collection can be filtered by album
Failure/Error: filtered.map(&:name).should =~ ['Fields of Gold', 'Autumn Leaves']
NoMethodError:
undefined method `map' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:55:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
7) Collection supports a conjuction of filters
Failure/Error: filtered.map(&:album).should eq ["Ten Summoner's Tales"]
NoMethodError:
undefined method `map' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:65:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
8) Collection supports a disjunction of filters
Failure/Error: filtered.map(&:album).should =~ [
NoMethodError:
undefined method `map' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:70:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
9) Collection supports negation of filters
Failure/Error: filtered.map(&:name).should eq ['Mad About You']
NoMethodError:
undefined method `map' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:79:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
10) Collection can be adjoined with another collection
Failure/Error: adjoined = sting.adjoin(eva)
NoMethodError:
undefined method `adjoin' for nil:NilClass
# /tmp/d20130203-23049-7qlizo/spec.rb:85:in `block (2 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.01301 seconds
11 examples, 10 failures
Failed examples:
rspec /tmp/d20130203-23049-7qlizo/spec.rb:4 # Collection can find all the artists in the collection
rspec /tmp/d20130203-23049-7qlizo/spec.rb:16 # Collection can find all the names of all songs in the collection
rspec /tmp/d20130203-23049-7qlizo/spec.rb:29 # Collection can find all the albums in the collection
rspec /tmp/d20130203-23049-7qlizo/spec.rb:43 # Collection can be filtered by song name
rspec /tmp/d20130203-23049-7qlizo/spec.rb:48 # Collection can be filtered by song name
rspec /tmp/d20130203-23049-7qlizo/spec.rb:53 # Collection can be filtered by album
rspec /tmp/d20130203-23049-7qlizo/spec.rb:63 # Collection supports a conjuction of filters
rspec /tmp/d20130203-23049-7qlizo/spec.rb:68 # Collection supports a disjunction of filters
rspec /tmp/d20130203-23049-7qlizo/spec.rb:77 # Collection supports negation of filters
rspec /tmp/d20130203-23049-7qlizo/spec.rb:82 # Collection can be adjoined with another collection
История (1 версия и 3 коментара)
Йоана обнови решението на 31.10.2012 15:34 (преди около 12 години)