Skip to content

Commit

Permalink
Refactored Session API specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ianwhite committed Aug 26, 2010
1 parent c1041c6 commit b9aaddb
Show file tree
Hide file tree
Showing 2 changed files with 128 additions and 269 deletions.
2 changes: 0 additions & 2 deletions lib/pickle/session/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@ module Api
# makes a model using the ref and fields, and stores it
def make_and_store(pickle_ref, fields = nil)
pickle_ref, attributes = ref(pickle_ref), attributes(fields)
raise InvalidPickleRefError, "#{pickle_ref.inspect} must not contain an index for #make_and_store" if pickle_ref.index
apply_label_attribute!(pickle_ref, attributes)
jar.store make(pickle_ref, attributes), pickle_ref
end

# finds a model using the ref and fields, and stores it
def find_and_store(pickle_ref, fields = nil)
pickle_ref, attributes = ref(pickle_ref), attributes(fields)
raise InvalidPickleRefError, "#{pickle_ref.inspect} must not contain an index for #make_and_store" if pickle_ref.index
jar.store find_first(pickle_ref, attributes), pickle_ref
end

Expand Down
Loading

0 comments on commit b9aaddb

Please sign in to comment.