On 9/7/07, Geoffrey Wiseman <[EMAIL PROTECTED]> wrote:
> I was planning on using a fixture within a description that didn't modify
> the fixture, so I put it in a before(:all) block:
> describe "Customer", "xml" do
>   fixtures :customers
>
>    before(:all) do
>      one = customers(:one)
>   end
>
>   # ...
>  As a result, I got this message:
>
> 1)
> NoMethodError in 'Customer xml before(:all)'
> You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.[]
> ./spec/models/customer_spec.rb:86:
> script/spec:4:
> If I convert it to before(:each) or simply before, it works just fine.
> describe "Customer", "xml" do
>    fixtures :customers
>
>    before do
>      one = customers(:one)
>   end
>
>    # ...
>  By design?  bug?  PEBKAC?  Anyone else hit this?
>

By design. Fixtures don't work with before(:all). There has been
several discussions about this on the list previously.

Aslak

>    - Geoffrey
> --
> Geoffrey Wiseman
>
> _______________________________________________
> rspec-users mailing list
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to