Hi. I found a strange bug in one of the tests that I can't explain. In spec/features/05_song_form_spec.rb there is a test that checks that the songs/new.erb form doesn't make a new Artist if that Artist exists. Somehow, that test passes even when I don't have that functionality in my form.
I poked around with binding.pry and discovered something: Artist.all had the Artist in its array when I paused between lines of code in the test. However, when I paused inside of my get 'songs/new' route, Artist.all returned a blank array; the same was true from within my songs/new.erb file.
Here is what my get 'songs/new' route looks like:
get '/songs/new' do
@artists = Artist.all
@genres = Genre.all
erb :"songs/new"
end
I don't see anything wrong with my controller. Any Artist that I create, shows up in my index and show pages, so I don't think there's anything wrong with my songs/new.erb file or any of my other routes, either.
Honestly, I have no idea why Artist.all returns a blank array when the test goes into my songs_controller.rb file. I just wanted to bring it to your attention.
Hi. I found a strange bug in one of the tests that I can't explain. In
spec/features/05_song_form_spec.rb
there is a test that checks that thesongs/new.erb
form doesn't make a new Artist if that Artist exists. Somehow, that test passes even when I don't have that functionality in my form.I poked around with
binding.pry
and discovered something:Artist.all
had the Artist in its array when I paused between lines of code in the test. However, when I paused inside of myget 'songs/new'
route, Artist.all returned a blank array; the same was true from within mysongs/new.erb
file.Here is what my
get 'songs/new'
route looks like:I don't see anything wrong with my controller. Any Artist that I create, shows up in my index and show pages, so I don't think there's anything wrong with my
songs/new.erb
file or any of my other routes, either.Honestly, I have no idea why
Artist.all
returns a blank array when the test goes into mysongs_controller.rb
file. I just wanted to bring it to your attention.Thanks for looking into this, as always.
---Sdcrouse