Sha256: 1e374d90986ba2f050cdc808fc638b8e959df545ee62370427e7d537b765b9fd

Contents?: true

Size: 1.42 KB

Versions: 22

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'
require 'shared/model_behaviour'

describe Ably::Models::ConnectionStateChange do
  let(:unique) { random_str }

  subject { Ably::Models::ConnectionStateChange }

  context '#current' do
    it 'is required' do
      expect { subject.new(previous: true) }.to raise_error ArgumentError
    end

    it 'is an attribute' do
      expect(subject.new(current: unique, previous: true).current).to eql(unique)
    end
  end

  context '#previous' do
    it 'is required' do
      expect { subject.new(current: true) }.to raise_error ArgumentError
    end

    it 'is an attribute' do
      expect(subject.new(previous: unique, current: true).previous).to eql(unique)
    end
  end

  context '#retry_in' do
    it 'is not required' do
      expect { subject.new(previous: true, current: true) }.to_not raise_error
    end

    it 'is an attribute' do
      expect(subject.new(retry_in: unique, previous: unique, current: true).retry_in).to eql(unique)
    end
  end

  context '#reason' do
    it 'is not required' do
      expect { subject.new(previous: true, current: true) }.to_not raise_error
    end

    it 'is an attribute' do
      expect(subject.new(reason: unique, previous: unique, current: true).reason).to eql(unique)
    end
  end

  context 'invalid attributes' do
    it 'raises an argument error' do
      expect { subject.new(invalid: true, current: true, previous: true) }.to raise_error ArgumentError
    end
  end
end

Version data entries

22 entries across 22 versions & 2 rubygems

Version Path
ably-rest-0.8.15 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-0.8.15 spec/unit/models/connection_state_change_spec.rb
ably-rest-0.9.3 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-rest-0.9.2 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-rest-0.9.1 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-rest-0.9.0 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-rest-0.8.14 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-0.8.14 spec/unit/models/connection_state_change_spec.rb
ably-rest-0.8.13 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-0.8.13 spec/unit/models/connection_state_change_spec.rb
ably-0.8.12 spec/unit/models/connection_state_change_spec.rb
ably-0.8.11 spec/unit/models/connection_state_change_spec.rb
ably-0.8.10 spec/unit/models/connection_state_change_spec.rb
ably-rest-0.8.9 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-0.8.9 spec/unit/models/connection_state_change_spec.rb
ably-0.8.8 spec/unit/models/connection_state_change_spec.rb
ably-0.8.7 spec/unit/models/connection_state_change_spec.rb
ably-0.8.6 spec/unit/models/connection_state_change_spec.rb
ably-rest-0.8.6 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb
ably-rest-0.8.5 lib/submodules/ably-ruby/spec/unit/models/connection_state_change_spec.rb