DEV: Fix failing tests.

approved

#1

DEV: Fix failing tests.

diff --git a/spec/models/user_profile_spec.rb b/spec/models/user_profile_spec.rb
index f4b64bc..c52427b 100644
--- a/spec/models/user_profile_spec.rb
+++ b/spec/models/user_profile_spec.rb
@@ -38,7 +38,7 @@ describe UserProfile do
   end
 
   describe 'new' do
-    let(:user_profile) { Fabricate.build(:user_profile) }
+    let(:user_profile) { UserProfile.new(bio_raw: "test") }
 
     it 'is not valid without user' do
       expect(user_profile.valid?).to be false

GitHub sha: 62579d79


Approved #2

#3

Grrr… I am not sure how much this fabrication library is really saving us long term.

Why even have a fabricator for user profile if we don’t want to use it?


#4

Fabricator is actually very useful and I sincerely hope we don’t use fixtures or even have to build records by hand. The test broke because I made changes to the default fabricator. I think I could have done Fabricate.build(:user_profile, user: nil) but it was much easier with the change I made,


#5

Note I don’t object to having helper that build up records for us, I have thought of “fast and safe fixture” pattern where you “record” the first time you create the record and on subsequent test runs can just replay the ultra fast recording.

My main gripe with the fabricator library is that a lot of magic is assumed when records are complicated and have a lot of dependencies so I kind of prefer an explicit implementation.


#6

I am also a big fan of fabricator overall. You will always find cases where fixtures are better and vice versa, but overall it works really well. I don’t think we should be making any hasty changes here.