title: RSpec - how to test default value for attribute using callback
body: <p>Here's my test:</p>
  
  <pre><code>require 'spec_helper'
  
  describe League do
  
      it 'should default weekly to false' do
        league = Factory.create(:league, :weekly =&gt; nil)
        league.weekly.should == false
      end
    end
  
  end
  </code></pre>
  
  <p>And here's my model:</p>
  
  <pre><code>class League &lt; ActiveRecord::Base
  
    validates :weekly, :inclusion =&gt; { :in =&gt; [true, false] }
  
    before_create :default_values
  
    protected
  
    def default_values
      self.weekly ||= false
    end
  
  end
  </code></pre>
  
  <p>When I run my test, I get the following error message:</p>
  
  <pre><code> Failure/Error: league = Factory.create(:league, :weekly =&gt; nil)
   ActiveRecord::RecordInvalid:
     Validation failed: Weekly is not included in the list
  </code></pre>
  
  <p>I've tried a couple different approaches to trying to create a league record and trigger the callback, but I haven't had any luck.  Is there something that I am missing about testing callbacks using RSpec?</p>