[rspec-users] Fixture name not available as class variable in spec
Graeme Nelson
graeme.nelson at gmail.com
Wed Feb 28 11:48:43 EST 2007
Hello Keith -
You can get access to your fixtures like so:
context "Some content" do
fixtures :users
setup do
end
specify "some specification" do
end
end
Thanks
graeme
On Feb 28, 2007, at 7:22 AM, Keith McDonnell wrote:
> Hi there,
>
> I can't seem to access the fixture name as a class variable from my
> specs. I have to set the variable in the spec setup.
>
> ... [fixtures]
>
> my_fixture:
> id: 1
>
> ... [rpsec]
>
> @my_fixture.id.should == 1
>
> ... [error]
>
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.id
>
> ... [my setup]
>
> RSpec-0.7.5.1 (r1395) - BDD for Ruby
> Rails 1.2.2
> Latest rspec_on_rails plugin
>
> Is this this a bug or a feature ?
>
> Keith
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
More information about the rspec-users
mailing list