How do I access specific factories created by creat_list?

14 views
Skip to first unread message

rya...@ichange.com

unread,
Jun 14, 2013, 2:13:12 PM6/14/13
to factor...@googlegroups.com

before(:each) do

          @created_challenges   = FactoryGirl.create_list(:challenge, 25)

          FactoryGirl.create(:user_challenge_owner,

                           :user => FactoryGirl.create(:user,

                                                       :email => 'uni...@unique.com',

                                                       :username => '1111111111'),

                           :challenge => created_challenges[0]) 

       end      


      it "excludes challenges owned by 1111111111 from total_pending" do 

        @created_challenges[0].start_date = 100.day.from_now                     

        Challenge.total_pending == 0       

      end


Failure/Error: :challenge => created_challenges[0])

     NameError:

       undefined local variable or method `created_challenges' for #<RSpec::Core::ExampleGroup::Nested_1::Nested_2::Nested_3:0xb26bc30>

     # ./spec/models/challenge_spec.rb:187:in `block (4 levels) in <top (required)>'



Reply all
Reply to author
Forward
0 new messages