Sha256: 7d59da163c20821029f98ea2940d79c3168165b078c366ffd718525f286434eb

Contents?: true

Size: 1.72 KB

Versions: 45

Compression:

Stored size: 1.72 KB

Contents

require 'spec_helper'
require 'shared/model_behaviour'

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

  subject { Ably::Models::ChannelStateChange }

  context '#current (#TH1)' 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 (#TH2)' 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 '#event (#TH5)' 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(event: unique, previous: unique, current: true).event).to eql(unique)
    end
  end

  context '#reason (#TH3)' 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 '#resumed (#TH4)' do
    it 'is false when ommitted' do
      expect(subject.new(previous: true, current: true).resumed).to be_falsey
    end

    it 'is true when provided' do
      expect(subject.new(previous: true, current: true, resumed: true).resumed).to be_truthy
    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

45 entries across 45 versions & 2 rubygems

Version Path
ably-rest-1.2.7 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.7 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.2.6 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.6 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.2.4 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.4 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.2.3 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.3 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.2.2 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.2 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.2.1 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.1 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.2.0 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.2.0 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.1.8 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.1.8 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.1.7 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.1.7 spec/unit/models/channel_state_change_spec.rb
ably-rest-1.1.6 lib/submodules/ably-ruby/spec/unit/models/channel_state_change_spec.rb
ably-1.1.6 spec/unit/models/channel_state_change_spec.rb