Class: Shoulda::Matchers::ActiveRecord::Uniqueness::TestModelCreator
- Inherits:
-
Object
- Object
- Shoulda::Matchers::ActiveRecord::Uniqueness::TestModelCreator
- Defined in:
- lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(model_name, namespace) ⇒ TestModelCreator
constructor
A new instance of TestModelCreator.
Constructor Details
#initialize(model_name, namespace) ⇒ TestModelCreator
Returns a new instance of TestModelCreator.
14 15 16 17 |
# File 'lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb', line 14 def initialize(model_name, namespace) @model_name = model_name @namespace = namespace end |
Class Method Details
.create(model_name, namespace) ⇒ Object
8 9 10 11 12 |
# File 'lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb', line 8 def self.create(model_name, namespace) Mutex.new.synchronize do new(model_name, namespace).create end end |
Instance Method Details
#create ⇒ Object
19 20 21 22 23 |
# File 'lib/shoulda/matchers/active_record/uniqueness/test_model_creator.rb', line 19 def create new_model.tap do |new_model| new_model.symlink_to(existing_model) end end |