Sha256: 71f06c08dd799b902dfb3c1128322b11ae70c68212b20f94fe223515a78c17f1

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Riak::Crdt::InnerRegister do
  let(:parent){ double 'parent' }
  subject { described_class.new parent, "espressos" }

  it 'feels like a string' do
    expect(subject).to match 'espressos'
    expect{ subject.gsub('s', 'x') }.to_not raise_error
    expect(subject.gsub('s', 'x')).to eq 'exprexxox'
  end

  describe 'immutability' do
    it 'is frozen' do
      expect(subject.frozen?).to be
    end
    it "isn't be gsub!-able" do
      # "gsub!-able" is awful, open to suggestions
      expect{ subject.gsub!('s', 'x') }.to raise_error
    end
  end

  describe 'updating' do
    let(:new_value){ 'new value' }
    it "asks the class for an update operation" do
      operation = described_class.update(new_value)

      expect(operation.value).to eq new_value
      expect(operation.type).to eq :register
    end
  end

  describe 'deleting' do
    it 'asks the class for a delete operation' do
      operation = described_class.delete

      expect(operation.type).to eq :register
    end
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
riak-client-2.5.0 spec/riak/crdt/inner_register_spec.rb
riak-client-2.4.1 spec/riak/crdt/inner_register_spec.rb
riak-client-2.4.0 spec/riak/crdt/inner_register_spec.rb
riak-client-2.4.0.pre1 spec/riak/crdt/inner_register_spec.rb
riak-client-2.3.2 spec/riak/crdt/inner_register_spec.rb
riak-client-2.3.1 spec/riak/crdt/inner_register_spec.rb
riak-client-2.3.0 spec/riak/crdt/inner_register_spec.rb
riak-client-2.2.2 spec/riak/crdt/inner_register_spec.rb
riak-client-2.2.1 spec/riak/crdt/inner_register_spec.rb
riak-client-noenc-1.0.0 spec/riak/crdt/inner_register_spec.rb
riak-client-2.2.0 spec/riak/crdt/inner_register_spec.rb