Sha256: 8f82841556694f141907efc48a9750739ac0dbd3f545e7eb0eb14ca92d8de36c
Contents?: true
Size: 1.1 KB
Versions: 5
Compression:
Stored size: 1.1 KB
Contents
$LOAD_PATH << File.dirname(__FILE__) require 'spec_helper' describe 'A REST adapter' do describe 'when updating an existing resource' do before do @books_xml = <<-XML <book> <id type='integer'>42</id> <title>Starship Troopers</title> <author>Robert Heinlein</author> <created-at type='datetime'>2008-06-08T17:02:28Z</created-at> </book> XML repository do |repo| @repository = repo @book = Book.new(:id => 42, :title => 'Starship Troopers', :author => 'Robert Heinlein', :created_at => DateTime.parse('2008-06-08T17:02:28Z')) @book.instance_eval { @new_record = false } @repository.identity_map(Book).set(@book.key, @book) @book.title = "Mary Had a Little Lamb" end end it 'should do an HTTP PUT' do adapter = @repository.adapter #DataMapper::Repository.adapters[:default] adapter.should_receive(:http_put).with('/books/42.xml', @book.to_xml) @repository.scope do @book.save end end end end
Version data entries
5 entries across 5 versions & 1 rubygems