Sha256: 5d4315f25fb911e5750a8af20483b9c806b3508cb089d83047120746a42feb99

Contents?: true

Size: 477 Bytes

Versions: 6

Compression:

Stored size: 477 Bytes

Contents

require_relative "helper"
require_relative "../lib/ohm/versioned"

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({})

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

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

  assert_equal expected, ex.attributes
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ohm-contrib-3.0.0 test/versioned.rb
ohm-contrib-2.2.0 test/versioned.rb
ohm-contrib-2.0.1 test/versioned.rb
ohm-contrib-2.0.0 test/versioned.rb
ohm-contrib-2.0.0.rc2 test/versioned.rb
ohm-contrib-2.0.0.rc1 test/versioned.rb