title: RSpec test to check (Rails model: validates :something, :inclusion => list from other activeRecord)
body: <p>Below is the code that I am using:</p>
  
  <p>This is my <code>app/models</code> file:</p>
  
  <pre><code>class One &lt; ActiveRecord::Base
    attr_accessible :name, :surname      
  end
  
  class Two &lt; ActiveRecord::Base  
    attr_accessible :name, :one_surname
  
    # generate a list of one's surnames
    def self.LIST_SURNAMES
      list  = Array.new
      arr   = One.all
      arr.each {|one| list &lt;&lt; one.surname}
  
      return list
    end
  
    validates :one_surname, :inclusion =&gt; self.LIST_SURNAMES()
  end
  </code></pre>
  
  <p>This is my <code>/spec/models</code> file:</p>
  
  <pre><code>FactoryGirl.define do
    factory :two do
      name "two_name"
    end
  
    factory :one do
      name "one_name"
      surname "one_surname"
    end    
  end
  
  describe Two do
    it 'should be created' do
      @one = FactoryGirl.create(:one)
  
      puts "One.last.surname = #{One.last.surname}"
      puts "Two.LIST_SURNAMES = #{Two.LIST_SURNAMES}"
  
      @two = FactoryGirl.build(:two, :one_surname =&gt; Two.LIST_SURNAMES[0])
  
      @two.save!
    end
  end 
  </code></pre>
  
  <p>However, my test fails. And I'm entirely unsure of why this is. Any thoughts?</p>
  
  <p>This is the <code>RSpec</code> output:</p>
  
  <pre><code>One.last.surname  = one_surname
  Two.LIST_SURNAMES = ["one_surname"]
  </code></pre>
  
  <p>Further, I am getting this failure:</p>
  
  <pre><code>  1) Two should be created
       Failure/Error: @two.save!
       ActiveRecord::RecordInvalid:
         Validation failed: One surname is not included in the list
   # ./category_spec.rb:29:in `block (2 levels) in &lt;top (required)&gt;'
  </code></pre>