search for: use_transactional_fixtur

Displaying 20 results from an estimated 53 matches for "use_transactional_fixtur".

2007 Aug 31
3
Setting use_transactional_fixtures=false for a single spec - a bad idea?
Hi! I would really like to find a way to allow me to write RSpec specifications for code that use database transactions. I know I can set config.use_transactional_fixtures = false in my spec_helper.rb. That works, and that''s great, but it will (I think) slow down my specs quite a bit. I would like to turn off transactional fixtures for just a single spec (describe), or even better, just a single example (it). I tried this: before(:all) do S...
2006 Apr 16
7
Problem running unit tests
...but would like to add proper testing from here on out. Currently when I type rake in my application directory, it attempts to load my unit tests (all generated files with single default assertion), but immediately fails with the error: ./test/unit/../test_helper.rb:18: undefined method ''use_transactional_fixtures='' I read up on transactional_fixtures and testing in general and also searched this list and in Google, but haven''t been able to find any reference to this problem. It is probably something stupid simple, but I am at a dead end for now. Has anyone else run into this? At this...
2006 Jun 28
2
undefined method `use_transactional_fixtures=''
Folks, I checked my test_helper.rb and it has self.use_transactional_fixtures = true My code was generated with 1.1.2 and I''m using 1.1.3 right now after but the error persists. I googled for this issue and it appears that a require is missing or something like that. I can''t figure it out, please help! /opt/local/bin/ruby -Ilib:test "/opt/loca...
2008 Mar 14
2
Lib Specs and config.use_transactional_fixtures = true
Hi We have specs in our rails project other than model/view/controller .. we have interests and lib ... using use_transactional_fixtures = true seems fine in a spec in the m/ v/c and interests directories but not in lib Just wondered if anyone had any quick thoughts as to why that may be??? Shane Mingins ELC Technologies (TM) 1921 State Street Santa Barbara, CA 93101 Phone: +64 4 568 6684 Mobile: +64 21 435 586 Email: sming...
2006 Nov 04
0
use_transactional_fixtures= and Test::Rails
With a normal test_helper, everything works just fine. However, if I change test_helper.rb to include test/rails and the class from Test::Unit::TestCase to Test::Rails::TestCase, I get this: ./test/functional/../test_helper.rb:19: undefined method `use_transactional_fixtures='' for Test::Rails::TestCase:Class (NoMethodError) from ./test/functional/contact_controller_test.rb:1 from /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5 from /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5...
2007 Jan 10
1
Solution for undefined method `use_transactional_fixtures=' ... problem
If you see this error message: undefined method `use_transactional_fixtures='' for Test::Unit::TestCase:Class (NoMethodError) You should check all your dependencies, all the lines containing require and especially require_dependency. You have probably done a refactoring "Rename" a class and forgot to propagate the change everywhere! More details on h...
2011 Jan 14
4
Rails 3 / RSpec 2 use_transactional_fixtures and after_commit
We''re migrating a Rails 2.3.x application to Rails 3 and RSpec 2.x. In Rails 2.3.x we were using https://github.com/freelancing-god/after_commit to provide after_commit functionality (now provided by Rails 3). The plugin version of after_commit came with some helpers to make testing with `use_transactional_fixtures = true` work. From: https://github.com/freelancing-god/after_commit "Keep in mind that transactions are finicky at best in tests, and so there?s a helper module to make after_commit play nicely in your testing context. You?ll need to add these two lines to your spec/test helper:"...
2006 Nov 24
13
rSpec on Rails 1.2?
I just updated my Rails install to the most current Edge and my controller specs fail: 1) TypeError in ''The User Controller should be a user controller'' can''t convert nil into String Each spec fails the same way. <context string> <spec string> can''t convert nil into String Any ideas what''s up with this? Thanks, s.ross
2006 May 05
7
Testing model: test becomes dependent on previous test
Im having trouble with Testing models. im following the tutorials in the book Agile Web Development with Rails. if i execute the code product_test.rb, i get this error: ============================================================ 1) Failure: test_update2(ProductTest) [test/unit/product_test.rb:30]: <29.95> expected but was <99.95>. 3 tests, 11 assertions, 1 failures, 0 errors
2007 Oct 25
6
Rollbacks, Sqlite3 bug
Okay - so the sqlite bug reported a day or so ago on the list is real bug. I''m going to file something in the tracker for that... I also learned that before(:all)...after(:all) is not wrapped in a transaction, the way before(:each)...after(:each) is. Is there some reason behind this? Can you not wrap transactions inside transactions? Scott
2007 Oct 08
3
test not rolling back
For testing, I use: self.use_transactional_fixtures = true This should cause a ROLLBACK for each test case. If I run a single file, foo_controller_test.rb, it works as expected. I see BEGIN and ROLLBACK 8 times in the log files. But if I run: rake test:functionals I get 3 COMMITs, 196 BEGINS and 193 ROLLBACKs. The code in fixtures.rb that de...
2008 Nov 06
3
Verifying some understanding about manipulating DB data in before/after callbacks in RSpec
We had an after(:each) callback that looked like this: PurchaseOrder.find(:all).each {|po| DraftInvoice.find_all_by_po_number(po.po_number).each {|di| di.destroy}} which we were hoping would reset some purchase order data in a certain way. However, because we have "self.use_transactional_fixtures = true" set in test_helper.rb, this code was never getting committed. So, I just want to verify: Attempting to manipulate data directly in the DB in a before/after callback doesn''t make sense since those changes will not persist across tests because of the transactionality impl...
2008 Feb 12
4
Funny behavior with Fixtures... on Ubuntu..
Hey Guys, I''ve got a test class that loads a bunch of fixtures. My understanding is that fixtures are reloaded between each test... and I even have the following two method calls at the top of my test class to make doubly sure... class TaskTest < Test::Unit::TestCase self.use_transactional_fixtures = true self.use_instantiated_fixtures = false When I run my tests individually... as in: ruby unit/task_test.rb --name test_update The tests run successfully to completion. However, when I try to run the entire test file in one go, I get failures. As in: ruby unit/task_test.rb > 8)...
2007 Apr 30
7
Migrating spec_helper with modifications
Hello, After moving into the HEAD of rspec, I am greeted with a mountain of errors, which I expected, due to my specs not being migrated. I use hpricot for a lot of my view tests, as it is extremely simple to traverse the DOM with it. I used to include HpricotSpecHelper in spec_helper.rb, like so: require ''hpricot_spec_helper'' module Spec module Rails module Runner
2011 Aug 10
1
How to stop Rspec loading my Cucumber fixtures
...far so good. Cucumber still loads the fixtures I moved as planned. But Rspec is still loading them too! This is despite `spec/spec_helper.rb` saying: config.fixture_path = "#{::Rails.root}/spec/fixtures" I have tried setting the following in `spec/spec_helper.rb`: config.use_transactional_fixtures = false However, it doesn''t work. And it wouldn''t be a long-term solution anyway, as I may need fixtures in Rspec in the future. How can I fix this? (Cross-posted from StackOverflow where there was no response.) -------------- next part -------------- An HTML attachment was...
2006 Jun 11
4
Model records are not saved to database in during tests
Hi, I''m trying to do unit tests which should save informations into a database that another computer should be able to get while the test is running. The problem is although my unit test class has "use_transactional_fixtures" set to false, when I create a new instance of a model and save it, it does not actually appear in the database when connecting to this same database with the "mysql" command line tool. The fixtures are the only present records. My question is: how to do so that the records...
2007 Mar 15
5
rake spec:views no transaction error
Hello, I have recently upgraded to the 0.8.2 release of rSpec, and I am receiving the following message with each view spec execution: WARNING: there is no transaction in progress I have upgraded the rspec_on_rails plugin as well, and both the model and controller tests are working flawlessly. Is there some simple step I missed? thanks for the input. -Chris -------------- next part
2005 Dec 23
6
Agile book - test error
Hi all, I get an error when testing the "store_controller_test.rb" The troublesome line is in the test below: def test_add_to_cart get :add_to_cart, :id => @version_control_book.id <<< cart = session[:cart] assert_equal @version_control_book.price, cart.total_price assert_redirected_to :action => ''display_cart'' follow_redirect
2006 Mar 20
3
Unit tests leave data behind when they should not
Hi, I was confused yesterday. I have bunch of tests and one of those was testing ActiveRecord::save and it was all right, but next method failed because table still had newly created record. All documentation suggests that it should not be the case and that data is reloaded from fixtures before every method is run. I am running edge rails and really did not have anything special done about
2009 Mar 19
6
[Cucumber 0.2] Failure to use should
I have a step definition like this: Then "the account should be created" do account = Account.find_by_name("my shiny new account") p account.class account.should_not be_blank end When running this step, I got the error message: Account(id: integer, name: string, state: string, next_renewal_at: date, created_at: datetime, updated_at: datetime, full_domain: string,