Skip to content

Instantly share code, notes, and snippets.

@mrmicahcooper
Created March 1, 2013 19:56
Show Gist options
  • Select an option

  • Save mrmicahcooper/5067287 to your computer and use it in GitHub Desktop.

Select an option

Save mrmicahcooper/5067287 to your computer and use it in GitHub Desktop.
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