Max Williams
2008-Feb-21 11:17 UTC
[rspec-users] Unwanted fixture data messing up my other tests
I have a fixture for one of my tables that i use in some model tests. The data in it is messing up some other tests for a different model, that doesn''t ask for the fixture - isn''t the fixture data supposed to be cleared out of the test db in between tests, and only be present if specifically asked for? or am i using them wrong? thanks max -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080221/efa88355/attachment-0001.html
David Chelimsky
2008-Feb-21 13:24 UTC
[rspec-users] Unwanted fixture data messing up my other tests
On Thu, Feb 21, 2008 at 6:17 AM, Max Williams <toastkid.williams at gmail.com> wrote:> I have a fixture for one of my tables that i use in some model tests. The > data in it is messing up some other tests for a different model, that > doesn''t ask for the fixture - isn''t the fixture data supposed to be cleared > out of the test db in between tests, and only be present if specifically > asked for? or am i using them wrong?It depends on settings you have in spec_helper.rb. You should have this: config.use_transactional_fixtures = true You should also not be declaring any fixtures in spec_helper.rb, given your situation. HTH, David> > thanks > max > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
Max Williams
2008-Feb-21 13:49 UTC
[rspec-users] Unwanted fixture data messing up my other tests
Hi David I have that option set already, and i''m not using any fixtures in spec_helper. My spec helper looks like this: is it the use_instantiated_fixtures option perhaps? (i don''t know what that does). thanks, max>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require ''spec'' require ''spec/rails'' require ''spec/custom_matchers'' Spec::Runner.configure do |config| # If you''re not using ActiveRecord you should remove these # lines, delete config/database.yml and disable :active_record # in your config/boot.rb config.use_transactional_fixtures = true config.use_instantiated_fixtures = false config.fixture_path = RAILS_ROOT + ''/spec/fixtures/'' #custom stuff config.include(CustomMatchers) def mock_login_required(allow_user_to_pass=true) controller.stub!(:login_required).and_return(allow_user_to_pass) end def mock_admin_user?(allow_user_to_pass=true) controller.stub!(:admin_user?).and_return(allow_user_to_pass) end def mock_current_user(id = 1) @user = mock_model(User, :to_param => id.to_s, :id => 1) controller.stub!(:current_user).and_return(@user) end end <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< On 21/02/2008, David Chelimsky <dchelimsky at gmail.com> wrote:> > On Thu, Feb 21, 2008 at 6:17 AM, Max Williams > <toastkid.williams at gmail.com> wrote: > > I have a fixture for one of my tables that i use in some model > tests. The > > data in it is messing up some other tests for a different model, that > > doesn''t ask for the fixture - isn''t the fixture data supposed to be > cleared > > out of the test db in between tests, and only be present if specifically > > asked for? or am i using them wrong? > > > It depends on settings you have in spec_helper.rb. You should have this: > > config.use_transactional_fixtures = true > > You should also not be declaring any fixtures in spec_helper.rb, given > your situation. > > HTH, > David > > > > > thanks > > max > > > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080221/a100597e/attachment.html