Created
August 4, 2017 03:51
-
-
Save YanKozlovskiy/9a1d7c6c8f19f2696590cca366b7ab56 to your computer and use it in GitHub Desktop.
error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Song | |
| #initialize | |
| accepts a name for the new song | |
| #name | |
| retrieves the name of a song | |
| #name= | |
| can set the name of a song | |
| @@all | |
| is initialized as an empty array | |
| .all | |
| returns the class variable @@all | |
| .destroy_all | |
| resets the @@all class variable to an empty array | |
| #save | |
| adds the Song instance to the @@all class variable | |
| .create | |
| initializes and saves the song | |
| Artist | |
| #initialize | |
| accepts a name for the new artist | |
| #name | |
| retrieves the name of an artist | |
| #name= | |
| can set the name of an artist | |
| @@all | |
| is initialized as an empty array | |
| .all | |
| returns the class variable @@all | |
| .destroy_all | |
| resets the @@all class variable to an empty array | |
| #save | |
| adds the Artist instance to the @@all class variable | |
| .create | |
| initializes and saves the artist | |
| Genre | |
| #initialize | |
| accepts a name for the new genre | |
| #name | |
| retrieves the name of a genre | |
| #name= | |
| can set the name of a genre | |
| @@all | |
| is initialized as an empty array | |
| .all | |
| returns the class variable @@all | |
| .destroy_all | |
| resets the @@all class variable to an empty array | |
| #save | |
| adds the Genre instance to the @@all class variable | |
| .create | |
| initializes and saves the genre | |
| Associations — Song and Artist: | |
| Artist | |
| #initialize | |
| creates a 'songs' property set to an empty array (artist has many songs) | |
| #songs | |
| returns the artist's 'songs' collection (artist has many songs) | |
| Song | |
| #initialize | |
| can be invoked with an optional second argument, an Artist object to be assigned to the song's 'artist' property (song belongs to artist) (FAILED - 1) | |
| Failures: | |
| 1) Associations — Song and Artist: Song #initialize can be invoked with an optional second argument, an Artist object to be assigned to the song's 'artist' property (song belongs to artist) | |
| Failure/Error: expect(song_with_artist.instance_variable_get(:@artist)).to be(artist) | |
| expected #<Artist:7745020> => #<Artist:0x00000000ec5bf8 @name="Neutral Milk Hotel", @songs=[], @artist=nil> | |
| got #<Artist:7744880> => #<Artist:0x00000000ec5ae0 @name=#<Artist:0x00000000ec5bf8 @name="Neutral Milk Hotel", @songs=[], @art...Song:0x00000000ec5b08 @name="Two-Headed Boy", @artist=#<Artist:0x00000000ec5ae0 ...>>], @artist=nil> | |
| Compared using equal?, which compares object identity, | |
| but expected and actual are not the same object. Use | |
| `expect(actual).to eq(expected)` if you don't care about | |
| object identity in this example. | |
| Diff: | |
| @@ -1,2 +1,12 @@ | |
| -#<Artist:0x00000000ec5bf8 @artist=nil, @name="Neutral Milk Hotel", @songs=[]> | |
| +#<Artist:0x00000000ec5ae0 | |
| + @artist=nil, | |
| + @name= | |
| + #<Artist:0x00000000ec5bf8 | |
| + @artist=nil, | |
| + @name="Neutral Milk Hotel", | |
| + @songs=[]>, | |
| + @songs= | |
| + [#<Song:0x00000000ec5b08 | |
| + @artist=#<Artist:0x00000000ec5ae0 ...>, | |
| + @name="Two-Headed Boy">]> | |
| # ./spec/004_songs_and_artists_spec.rb:32:in `block (4 levels) in <top (required)>' | |
| Finished in 0.22632 seconds (files took 0.89813 seconds to load) | |
| 27 examples, 1 failure | |
| Failed examples: | |
| rspec ./spec/004_songs_and_artists_spec.rb:28 # Associations — Song and Artist: Song #initialize can be invoked with an optional second argument, an Artist object to be assigned to the song's 'artist' property (song belongs to artist) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment