Sha256: ea270b01563ec19111bb6c796892298016285e4378f375a3aa42f083dceb3fc1

Contents?: true

Size: 1.09 KB

Versions: 17

Compression:

Stored size: 1.09 KB

Contents

require 'minitest_helper'

describe Repository, 'Revert' do

  let(:repository) { Repository.new :test }

  it 'Insert' do
    repository[:countries].insert 'AR', name: 'Argentina'

    reverted_delta = repository.revert

    reverted_delta.must_equal 'countries' => {'AR' => {'action' => 'delete'}}
    repository.wont_be :changes?
  end

  it 'Update' do
    repository[:countries].insert 'AR', name: 'Argentina'
    repository.commit author: 'User', message: 'Commit message'

    repository[:countries].update 'AR', name: 'Republica Argentina'

    reverted_delta = repository.revert

    reverted_delta.must_equal 'countries' => {'AR' => {'action' => 'update', 'data' => {'name' => 'Argentina'}}}
    repository.wont_be :changes?
  end

  it 'Delete' do
    repository[:countries].insert 'AR', name: 'Argentina'
    repository.commit author: 'User', message: 'Commit message'

    repository[:countries].delete 'AR'

    reverted_delta = repository.revert

    reverted_delta.must_equal 'countries' => {'AR' => {'action' => 'insert', 'data' => {'name' => 'Argentina'}}}
    repository.wont_be :changes?
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
eternity-4.0.0 spec/revert_spec.rb
eternity-3.0.1 spec/revert_spec.rb
eternity-3.0.0 spec/revert_spec.rb
eternity-2.0.1 spec/revert_spec.rb
eternity-2.0.0 spec/revert_spec.rb
eternity-1.1.1 spec/revert_spec.rb
eternity-1.1.0 spec/revert_spec.rb
eternity-1.0.0 spec/revert_spec.rb
eternity-0.1.3 spec/revert_spec.rb
eternity-0.1.2 spec/revert_spec.rb
eternity-0.1.1 spec/revert_spec.rb
eternity-0.1.0 spec/revert_spec.rb
eternity-0.0.5 spec/revert_spec.rb
eternity-0.0.4 spec/revert_spec.rb
eternity-0.0.3 spec/revert_spec.rb
eternity-0.0.2 spec/revert_spec.rb
eternity-0.0.1 spec/revert_spec.rb