Permalink
Browse files

Calling new_<stub>! twice would give back two of the same

Signed-off-by: rick <technoweenie@gmail.com>
  • Loading branch information...
1 parent 6090cee commit f8068753a80ae2f3e5b20b7b63f9c808560af80a @lawrencepit lawrencepit committed with Sep 30, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/model_stubbing/stub.rb
@@ -41,7 +41,7 @@ def default?
# pass :id => :new to specify you want a new record, not one in the database
def record(attributes = {})
this_record_key = record_key(attributes)
- if attributes[:id] != :new && ModelStubbing.records.key?(this_record_key)
+ if attributes[:id] != :new && attributes[:id] != :dup && ModelStubbing.records.key?(this_record_key)
ModelStubbing.records[this_record_key]
else
ModelStubbing.records[this_record_key] = instantiate(this_record_key, attributes)

0 comments on commit f806875

Please sign in to comment.