Created
March 1, 2013 19:56
-
-
Save mrmicahcooper/5067287 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unless defined?(Rails) | |
| require 'active_record' | |
| connection_info = YAML.load(File.open("config/database.yml"))["test"] | |
| ActiveRecord::Base.establish_connection(connection_info) | |
| RSpec.configure do |config| | |
| config.around do |example| | |
| ActiveRecord::Base.transaction do | |
| example.run | |
| raise ActiveRecord::Rollback | |
| end | |
| end | |
| end | |
| def errors_on(attribute) | |
| self.valid? | |
| [self.errors[attribute]].flatten.compact | |
| end | |
| alias :error_on :errors_on | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment