I have something like this in my RSpec file (it works fine for me):
before do
@attr = attributes_for(:album)
post :create, album: @attr
end
it { expect(Album.exists?(@attr)).to be_true }
it { expect(response).to redirect_to(assigns[:album]) }
Is it possible to make it without attributes_for(:album) in a separate line and @attr variable ? Or maybe even other better way..
@attrtemp. variable. I believe it can be done more.. Ruby :)