Skip to content

Instantly share code, notes, and snippets.

@Jesus
Created January 13, 2017 16:45
Show Gist options
  • Save Jesus/d09d8418458963bca8abfc8b4beb9963 to your computer and use it in GitHub Desktop.
Save Jesus/d09d8418458963bca8abfc8b4beb9963 to your computer and use it in GitHub Desktop.
it "serializes an array of associated records" do
item_a = create :image_item
item_b = PreviewItem.new
item_b.preview_item_id = item_a.id
item_b.preview = item_a.preview
item_b.save!
items = [item_a, item_b]
# items = [item_a.reload, item_b.reload]
items = Marshal.load(Marshal.dump(items))
items.each do |item|
expect(item).to be_a(PreviewItem)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment