Sha256: 98fecf1f6a04eb7febb21548c109d8f8307f46f3821804310baf16addcec894d
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
require File.join(File.dirname(__FILE__), 'test_helper.rb') class DocInstance < Exegesis::Document expose :foo end class ExegesisDocumentInstanceMethodsTest < Test::Unit::TestCase context "update_attributes" do before do reset_db end context "an existing doc" do before do @doc = DocInstance.new({'foo' => 'bar'}) @doc.database = @db @doc.save @old_rev = @doc.rev end context "without a matching rev" do expect { lambda {@doc.update_attributes({'foo' => 'bee'})}.will raise_error(ArgumentError) } expect { lambda {@doc.update_attributes({'foo' => 'bee', '_rev' => 'z'})}.will raise_error(ArgumentError) } end context "with a matching rev" do before do @doc.update_attributes({'_rev' => @doc.rev, 'foo' => 'bee', 'bar' => 'boo'}) end expect { @doc['foo'].will == 'bee' } expect { @doc['bar'].will be(nil) } expect { @doc.rev.wont == @old_rev } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems