Sha256: c179f7ae21da9b46ece79d9e5f4ca81e1bea72335e4e01fddb1aa5c01450c064

Contents?: true

Size: 437 Bytes

Versions: 1

Compression:

Stored size: 437 Bytes

Contents

require_relative "helper"

class Article < Ohm::Model
  include Ohm::Versioned

  attribute :title
  attribute :content
end

test do
  a1 = Article.create(title: "Foo Bar", content: "Lorem ipsum")
  a2 = Article[a1.id]

  a1.update({})

  begin
    a2.update(title: "Bar Baz")
  rescue Ohm::VersionConflict => ex
  end

  expected = { title: "Bar Baz", _version: "1", content: "Lorem ipsum" }

  assert_equal expected, ex.attributes
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohm-contrib-1.0.0.rc2 test/versioned.rb