[rspec-users] uh... fixtures?
David Chelimsky
dchelimsky at gmail.com
Sun Feb 17 22:21:53 EST 2008
On Feb 17, 2008 9:49 PM, Phlip <phlip2005 at gmail.com> wrote:
> RSpec-ers:
>
> I'm aware this is quite the FAQ. I have probably asked it myself, but I just
> can't Google up anything but others asking it.
>
> I grabbed the source to Beast, to use as a Rails project uninfluenced by me, or
> RSpec. Then I installed the CURRENT version of RSpec and rspec_on_rails, and set
> up a model spec on Post.
>
> Here's the spec_helper.rb lines:
>
> config.use_transactional_fixtures = true
> config.use_instantiated_fixtures = false
> config.fixture_path = RAILS_ROOT + '/test/fixtures/'
> # borrow existing ones ^
> config.global_fixtures = :posts, :topics, :users
>
> And here's a Beast test translated into a spec:
>
> describe Post do
> fixtures :forums, :moderatorships, :monitorships, :posts, :topics, :users
>
> it 'should require body for post' do
> @post = topics(:pdi).posts.build
s/pdi/pid
Funny that the typo should lead you to PDI :)
> @post.valid?
> assert @post.errors.on(:body)
> end
> end
>
> And the whiny nil error message hits topics(:pid).
>
> Any ideas?
>
> --
> Phlip
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
More information about the rspec-users
mailing list