Permalink
Browse files

remove old links from the readme

  • Loading branch information...
1 parent 93772db commit d7639d60e71db21c171bbb0cbaa4734a0ad49c92 @dan-manges committed Mar 14, 2014
Showing with 12 additions and 16 deletions.
  1. +2 −2 CHANGELOG
  2. +1 −1 LICENSE
  3. +9 −13 README.markdown → README.md
View
@@ -1,8 +1,8 @@
-*0.9.1*
+*0.9.1* (April 22, 2009)
* Rails 2.3 compatibility
-*0.9.0*
+*0.9.0* (December 15, 2008)
* Add association stubbing with mocha
View
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2008 Dan Manges
+Copyright (c) 2007-2014 Dan Manges
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -12,7 +12,7 @@ One of the biggest benefits to disconnecting unit tests from the database is hav
Finished in 19.302702 seconds.
4920 tests, 7878 assertions, 0 failures, 0 errors
-
+
4 seconds per 1,000 tests is a good guideline.
Installation
@@ -55,7 +55,7 @@ In the <tt>test/unit/unit\_test\_helper.rb</tt> file you created when restructur
require File.dirname(__FILE__) + "/../test_helper"
require "unit_record"
ActiveRecord::Base.disconnect!
-
+
The <tt>disconnect!</tt> method will do everything necessary to run your unit tests without hitting the database.
Strategy
@@ -66,17 +66,17 @@ There are two options for what should happen if you hit the database. You can ei
If you want to raise an exception:
ActiveRecord::Base.disconnect! :strategy => :raise
-
+
Person.find(:all)
#=> RuntimeError: ActiveRecord is disconnected; database access is unavailable in unit tests.
If you want to no-op:
ActiveRecord::Base.disconnect! :strategy => :noop
-
+
Person.find(:all)
#=> []
-
+
You can also change strategies within a block:
ActiveRecord::Base.connection.change_strategy(:raise) do
@@ -88,15 +88,15 @@ You can also change strategies within a block:
Person.find(:all)
#=> []
end
-
+
Association Stubbing
--------------------
One painful aspect of unit testing ActiveRecord classes is setting associations. Because Rails does type checking when setting an association, you'll receive an exception if you try to use a stub in place of the expected class.
Pet.new :owner => stub("person")
#=> ActiveRecord::AssociationTypeMismatch: Person(#16620740) expected, got Mocha::Mock(#11567340)
-
+
If you're using mocha, you can have UnitRecord stub associations. To enable association stubbing:
ActiveRecord::Base.disconnect! :stub_associations => true
@@ -105,17 +105,13 @@ The above example would no longer raise an exception. It would be the equivalent
pet = Pet.new
pet.stubs(:owner).returns(stub("person"))
-
+
Note that using this approach, the setter for the association will not work for that instance.
Development
-----------
-Active development occurs on the [GitHub](http://github.com/dan-manges/unit-record). Changes are also pushed to the Rubyforge git repository.
-
-For bugs/patches/etc please use the [Rubyforge tracker](http://rubyforge.org/tracker/?group_id=4239).
-
-Continuous integration is provided by [RunCodeRun](http://runcoderun.com/dan-manges/unit-record).
+Active development occurs on the [GitHub](http://github.com/dan-manges/unit-record).
Thanks
------

0 comments on commit d7639d6

Please sign in to comment.