Commit ef3febbb

mo khan <mo@mokhan.ca>
2014-07-06 03:21:54
stop sending welcome emails in tests and clean up some duplication.
1 parent ff50675
Changed files (2)
app/models/creation.rb
@@ -16,11 +16,11 @@ class Creation < ActiveRecord::Base
   end
 
   def primary_image
-    photos.any? ? photos.sample : Photo.new
+    published? ? photos.sample : Photo.new
   end
 
   def published?
-    photos.count > 0
+    photos.any?
   end
 
   def is_liked_by(user)
app/models/user.rb
@@ -1,6 +1,6 @@
 class User < ActiveRecord::Base
   before_save :ensure_authentication_token
-  after_create :send_welcome_email
+  after_create :send_welcome_email unless Rails.env.test?
 
   validates :name,  :presence => true
   validates :website, :format => URI::regexp(%w(http https)), :allow_blank => true