README.md in with_model-2.1.0 vs README.md in with_model-2.1.1

- old
+ new

@@ -1,9 +1,10 @@ # [with_model](https://github.com/Casecommons/with_model) [![Gem Version](https://img.shields.io/gem/v/with_model.svg?style=flat)](https://rubygems.org/gems/with_model) [![Build Status](https://secure.travis-ci.org/Casecommons/with_model.svg?branch=master)](https://travis-ci.org/Casecommons/with_model) +[![API Documentation](https://img.shields.io/badge/yard-api%20docs-lightgrey.svg)](https://www.rubydoc.info/gems/with_model) `with_model` dynamically builds an ActiveRecord model (with table) before each test in a group and destroys it afterwards. ## Development status @@ -159,12 +160,21 @@ end ``` ## Requirements -- Ruby 2.1+ -- RSpec or minitest/spec -- ActiveRecord 4.2+ +See the [gemspec metadata](https://rubygems.org/gems/with_model) for dependency requirements. RSpec and minitest are indirect dependencies, and `with_model` should support any maintained version of both. + +## Thread-safety + +- A unique table name is used for tables generated via `with_model`/`WithModel::Model.new`. This allows `with_model` (when limited to this API) to run concurrently (in processes or threads) with a single database schema. While there is a possibility of collision, it is very small. +- A user-supplied table name is used for tables generated via `with_table`/`WithModel::Table.new`. This may cause collisions at runtime if tests are run concurrently against a single database schema, unless the caller takes care to ensure the table names passed as arguments are unique across threads/processes. +- Generated models are created in stubbed constants, which are global; no guarantee is made to the uniqueness of a constant, and this may be unsafe. +- Generated classes are ActiveRecord subclasses: + - This library makes no guarantee is made as to the thread-safety of creating ActiveRecord subclasses concurrently. + - This library makes no guarantee is made as to the thread-safety of cleaning up ActiveRecord/ActiveSupport’s internals which are polluted upon class creation. + +In general, `with_model` is not guaranteed to be thread-safe, but is, in certain usages, safe to use concurrently across multiple processes with a single database schema. ## Versioning `with_model` uses [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html).