Sha256: 0ad8d9c94a1f480bc1df8d5624af265c372fd46e06f32ad898762fb6a86d156a

Contents?: true

Size: 505 Bytes

Versions: 4

Compression:

Stored size: 505 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation, '#update' do
  include_context 'Relation'

  subject { relation.update(john, old_tuple) }

  let!(:old_tuple) { relation.mapper.dump(john) }

  it { should be_instance_of(Relation) }

  before do
    john.name = 'John Doe'
  end

  it 'replaces old object with the new one' do
    expect(subject.restrict(name: 'John Doe').one).to eq(john)
  end

  it 'removes old object' do
    expect(subject.restrict(name: 'John').count).to be(0)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rom-0.2.0 spec/unit/rom/relation/update_spec.rb
rom-relation-0.1.2 spec/unit/rom/relation/update_spec.rb
rom-relation-0.1.1 spec/unit/rom/relation/update_spec.rb
rom-relation-0.1.0 spec/unit/rom/relation/update_spec.rb